上一页 1 2 3 4 5 6 7 ··· 14 下一页
摘要: 1028139825661085170910851171139820792069208221522189 阅读全文
posted @ 2013-10-24 21:02 Geekers 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 //LineTable 2 //先是联合体union,,后是结构体,复合型数据类型的一种自定义类型 3 4 5 //内存分配,按整分配。和CPU相关,数据总线 6 //结构体中内存的分配 7 /* 8 内存空洞大,更容易中病毒 9 10 char a[4] = "xyw"; 11 12 char b = 'x'; 13 char c = 'y'; 14 char d = 'w'; 15 16 17 内存分配, 有效字节 18 */ 19 /* 20 21 特点一 22 23 24 如果... 阅读全文
posted @ 2013-10-23 15:16 Geekers 阅读(522) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 9 10 //C语言的文件操作 11 /* 12 13 FILE *指针变量标识符 14 15 //fopen fclose 16 17 18 //fgetc fputc //by Character 字符读写 19 //fgets fputs //by stream 字符串读写 20 //fread fwr... 阅读全文
posted @ 2013-10-23 15:11 Geekers 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 1 //模拟机排序 2 //运用链性队列(先进先出) 3 // 4 5 #include 6 7 using namespace std; 8 9 typedef struct _NODE_ 10 { 11 int a; //没有再用一个DATA来封数据域,这里只有数据 int a 12 _NODE_* pNext; 13 14 }Node,*pNode; 15 16 17 18 class CQueue //封装成queue类 19 { 20 private: //私有成员pTop 和 pBase 21... 阅读全文
posted @ 2013-10-22 20:48 Geekers 阅读(168) 评论(0) 推荐(0) 编辑
摘要: //http://acm.hdu.edu.cn/showproblem.php?pid=1098/*题目说x任意,于是取x=1,公式变为f(x)=5+13+k*a然后从小到大枚举a,满足f(x)%65==0即输出,枚举a为1到64,因为a>=65时可简化为 65+i,65可以约去有一个函数: f(x)=5*x^13+13*x^5+k*a*x给定一个非负的 k 值 求最小的非负的 a 值 使得对任意的整数x都能使 f(x) 被 65 整除。每输入一个k 值 , 对应输出一个 a值 , 若不存在a值 则输出 no 数学归纳法证明:1.假设当x=n时,f(n)=........... 阅读全文
posted @ 2013-10-22 20:27 Geekers 阅读(476) 评论(0) 推荐(0) 编辑
摘要: //http://acm.hdu.edu.cn/showproblem.php?pid=2098//标准的筛选法 #includeusing namespace std;bool prime[10000+5]; //题目中给出了数值不会超过10000,这样刚好能够用筛选法 void Init() //直接初始化素数表就好了。 { for(int i = 2; i <= 10000; ++i) //初始条件为都是素数 { prime[i] = true; } for(int i =2;i <= 10000; ++i) ... 阅读全文
posted @ 2013-10-17 22:00 Geekers 阅读(273) 评论(0) 推荐(0) 编辑
摘要: //超级水题,热身的,没必要解释//http://acm.hdu.edu.cn/showproblem.php?pid=2161#includeusing namespace std;bool IsPrime(int n){ int i = 0; if(n0 ) { count++; if(IsPrime(N)) printf("%d: yes\n",count); else printf("%d: no\n",count); } return 0;} 阅读全文
posted @ 2013-10-17 21:38 Geekers 阅读(217) 评论(0) 推荐(0) 编辑
摘要: //http://acm.hdu.edu.cn/showproblem.php?pid=1395//同样,快速幂取余不用解释,注意点输出格式就行了//注意全部使用位运算#includeusing namespace std;__int64 Montgomery(int a, int b, int r){ __int64 ans=1, buff=a; while(b) { if(b&1) ans = ans*buff%r; buff = buff*buff%r; b>>=1; } return ans;}int ma... 阅读全文
posted @ 2013-10-17 20:30 Geekers 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 人见人爱A^BTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17481Accepted Submission(s): 12376Problem Description求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1 3 4 using namespace std; 5 6 __int64 qpow(int a,int b,int r) 7 {... 阅读全文
posted @ 2013-10-17 20:16 Geekers 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 1 //对于插入,一般都是现查找再插入,这指的是数据不会相同的情况下 2 /*然后另外一个问题,关于数据的前移问题,,使用的非用for循环一个一个向前移动, 3 而是使用了memcpy进行整体往前拷贝。 4 注意,如果是数据的后移,可以用strcpy,但是前移绝对不能用。 5 6 因为是先查再进行插入,所以在Insert中肯的有一个FindData函数进行查找. 7 8 删除数据时,先找到数据,然后memcpy进行“删除”. 9 */ 10 11 /* 12 本代码为线性表的管理, 13 用到了就是Insert,Delete,Find,Travel等函... 阅读全文
posted @ 2013-10-17 10:31 Geekers 阅读(648) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 14 下一页