摘要: 简单的递归。 我打算复试结束了再看算法。现在靠做题练习。 要用__int64,a[30][0]=113585929507107651,a[30][1]=41575339372525900 #include int main() { int n, i; __int64 a[34]={1, 3,... 阅读全文
posted @ 2015-03-13 13:23 StevenLuke 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 最后数据会超过 2 ^32 - 1。 输出%用%%。 #include #include int main() { int n, i, k; __int64 a[21][2]={{1, 0}, {1, 0}, {2, 1}}; for(i=3; i<21; i++) { a[i][0] = ... 阅读全文
posted @ 2015-03-13 13:06 StevenLuke 阅读(117) 评论(0) 推荐(0) 编辑
摘要: PE了好多次。 ' * ‘'在格式化输入输出中的作用。 在scanf()中,用%*#,就代表读入一个#的数据,但不处理。比如: scanf("%c%*c%c", &a, &b); 输入ABC,此时,变量a='A', c='C'。而中间的'B',只是读入,没有做任何处理。 在printf()中,%... 阅读全文
posted @ 2015-03-13 11:33 StevenLuke 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 第31行的getchar();如果写了就是WA,不写就是AC。 但是第九行的getchar();一定要写。 函数gets的原型为:char*gets(char*buffer); 在 stdio.h中定义,如果要程序中用到此函数需包含#include gets()函数用来从标准输入设... 阅读全文
posted @ 2015-03-13 00:24 StevenLuke 阅读(145) 评论(0) 推荐(0) 编辑
摘要: fabs()是对浮点数取绝对值,abs()是对整数取绝对值。 printf("%d %d %.0lf\n", a+1, b+1, max); %.0lf #include #include int main() { int n, m, i, j, a, b; double d, max; wh... 阅读全文
posted @ 2015-03-12 23:35 StevenLuke 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 简单的递归 #include int main() { int n, a[55]={1, 2, 3, 4, 6}, i; for(i=5; i<55; i++) a[i] = a[i-1] + a[i-3]; while(~scanf("%d", &n)) { if(n==0) brea... 阅读全文
posted @ 2015-03-12 16:20 StevenLuke 阅读(90) 评论(0) 推荐(0) 编辑
摘要: c语言中任何非零值在需要布尔值的地方都被看做true #include int main(void){ int i, n, m, b, c; while (scanf("%d%d", &n, &m) != EOF) { b = 2; c = 0; ... 阅读全文
posted @ 2015-03-12 15:47 StevenLuke 阅读(118) 评论(0) 推荐(0) 编辑
摘要: #include int main() { int n, sum, a, b, c, d, e, f, i, temp ,ans; while(scanf("%d", &n) != EOF) { if(n==0) break; sum = 0; for(i=0; i<n; i++) { ... 阅读全文
posted @ 2015-03-12 14:35 StevenLuke 阅读(163) 评论(0) 推荐(0) 编辑
摘要: ps:写了85道水题后,从4w+的排名到了1w+,现在升排名满了许多,AC一道题大概升100+的排名。 sort(a, a+ids+1);这里要+1 #include #include #include using namespace std;int main(void) { int a[1... 阅读全文
posted @ 2015-03-10 11:11 StevenLuke 阅读(157) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2036 利用了已知三角形的三个顶点的坐标求面积的方法。 ... 阅读全文
posted @ 2015-03-08 15:56 StevenLuke 阅读(455) 评论(0) 推荐(0) 编辑