(1)指针就是地址,也就是说在某一位数确定的操作系统中,他的范围是可以确定的,就是说指针变量的sizeof值是相等的。
比如32位系统下,不管是指向char、int、还是long型变量的指针,他的大小都是4字节
(2)sizeof是关键字,求值是发生在编译的时候,他不同于函数,因为函数的求值是发生在运行的时候。且看:
int ch[6];
sizeof(ch[6]);//是存在的,...
分类:
其他好文 时间:
2015-04-04 12:20:48
阅读次数:
165
先来分析一个简单的例子。(注意容易出错)
代码非常简单
#include
#include
using namespace std;
int main(){
const int a = 1;
int* b = (int*)&a;
*b = 2;
cout << a << endl << *b << endl;
return 0;
}
反汇编分析 重点之处有注释
1: #i...
分类:
其他好文 时间:
2015-04-04 12:20:37
阅读次数:
127
原文链接 : Architecting An Investigation into Flow and Mortar
译者 : sundroid( chaossss 协同翻译)
校对者: chaossss、Mr.Simple
状态 : 完成
“在 App 开发过程中尽可能使用 Fragment 替代 Activity”,Google 官方的这个建议无疑让万千 Android 开发者开始关注、使用...
分类:
其他好文 时间:
2015-04-04 12:21:44
阅读次数:
178
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3782
题意:
求给定的算式的结果。
法一:
因为固定三个数字,两个运算符,直接if else就行。
代码:
#include
using namespace std;
int main()
{
int t;
char x,...
分类:
其他好文 时间:
2015-04-04 12:21:23
阅读次数:
227
题意: 给出一个target找出他在有序数组中的位置
思路1: 直接遍历 复杂度O(N)
代码1:
public int searchInsert1(int[] A, int target) {//直接遍历 算法O(N)
int i = 0;
if(target A[A.len...
分类:
其他好文 时间:
2015-04-04 12:20:44
阅读次数:
114
/*这段代码写的是JE分词器对于所输入的文本进行分词
* 这里还可以自己设定,分词的范围和单个词语,这样用户可以更加方便对想要
*处理的文本更加的灵活多变。
*这里我添加的例子是.addWord(“回首雅虎在中国”);
* */
package analyzer;
import jeasy.analysis.MMAnalyzer;
public class...
分类:
其他好文 时间:
2015-04-04 12:18:55
阅读次数:
137
题目大意:
有N个地点和M条有向街道,现在要在点上放一些伞兵,伞兵可以沿着有向街道走,直到不能走为止。
每条边只能被一个伞兵走一次。问:至少放多少伞兵,能使伞兵可以走到图上所有的点。
思路:
很明显的最小路径覆盖问题。先转换为二分图,先将N个点每个点拆成两个点,左边是1~N个点,右
边也是1~N个点。将有向街道变为左边点指向右边点的边。
因为二分图最小路径覆盖 = 点数 - 二分图最大匹配数,则求出结果就是放的最少伞兵数。...
分类:
其他好文 时间:
2015-04-04 12:19:34
阅读次数:
134
问题:
5个人坐在一起,第5个人说他比第四个大2岁,第4个说比第三个大2岁,第3个说比第二个大2岁, 第2个说比第1个大2岁,第一个说自己10岁,当输入第几个人的时候求出其对应的年龄。
#include
#include
int age(int n);
/* run this program using the console pauser or add your ow...
分类:
其他好文 时间:
2015-04-04 12:20:41
阅读次数:
233
题目链接:largest-number
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
*
Given a list of non negative integers, arrange them such that they form the largest n...
分类:
其他好文 时间:
2015-04-04 12:19:51
阅读次数:
146
问题:
5个人夜间捕鱼,早上A先醒来,将鱼分为5份,将多的一条扔进海里,然后B醒来,不知道A已经拿走一份鱼,就将剩下的鱼分成5份,扔掉多余的一条,接着C,D,E醒来,按同样的方法分鱼,问这5个人合伙捕到多少条鱼,每个人醒来后所看到多少条鱼。
#include
#include
int fish(int n, int x);
/* run this program us...
分类:
其他好文 时间:
2015-04-04 12:18:02
阅读次数:
193
问题:
汉诺塔。
#include
#include
void hanoi(int N, char A, char B, char C);
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int ar...
分类:
其他好文 时间:
2015-04-04 12:17:57
阅读次数:
184
问题:
一只猴子摘了一些桃子,第一天吃了其中的一半然后又吃了一个,以后照此方法,直到第10天早上,猴子发现只剩下一个桃子,问猴子第一天摘了多桃子。
#include
#include
int A(int n);
/* run this program using the console pauser or add your own getch, system("paus...
分类:
其他好文 时间:
2015-04-04 12:18:36
阅读次数:
184
Find a way
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4854 Accepted Submission(s): 1650
Problem Description
Pass a year learnin...
分类:
其他好文 时间:
2015-04-04 12:16:58
阅读次数:
155
问题:
杨辉三角
#include
#include
int c(int x, int y);
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) ...
分类:
其他好文 时间:
2015-04-04 12:19:16
阅读次数:
150
关于自然常数e的理解
By Z.H. Fu
切问录 ( http://www.fuzihao.org ) 利息增长模型 在上中学学习对数的时候,我们就学到了一个叫做e的东西(e≈2.71828e\approx 2.71828),后来又学了e的定义,(e=limn→∞(1+1n)ne=\lim \limits_{n\to \infty}(1+\frac{1}{n})^n),但是始终缺乏一个直...
分类:
其他好文 时间:
2015-04-04 12:18:54
阅读次数:
181
大致题意:简单题意就不解释了。
不过可以建议大家可以先做POJ 3070,先学会快速幂的基本思想。
没有做过的可以查看我的博客:点击打开链接
然后我们已经会使用矩阵快速幂求解A^k,则如何求解 A+A^2+A^3……
这里还是运用了二分的思想 ,例如:
令S(N)=A+A^2+……+A^N;
则S(6)=A+A^2+A^3+A^4+A^5+A^6=(1+A^3)...
分类:
其他好文 时间:
2015-04-04 12:17:44
阅读次数:
168
题目:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
思路:从一个数组中找到中间的元素作为BST的根,然后坐边的作为左子树,右边的作为右子树,递归调用
#include
#include
#include
#include
...
分类:
其他好文 时间:
2015-04-04 12:18:29
阅读次数:
132