杭电acm
我是小小朋友
这个作者很懒,什么都没留下…
展开
-
A+B for Input-Output Practice (V)
#include int main() { int a,k,n,i,j,s; scanf("%d",&n); for(j=0;j { while(scanf("%d",&k)!=EOF) { s=0; for(i=0;i {scanf("%d",&a); s=s+a;} printf("%d\n",s); }} retur原创 2014-01-25 16:26:29 · 357 阅读 · 0 评论 -
A+B for Input-Output Practice (I)
#include int main() { int a,b,s; while (scanf("%d%d",&a,&b)!=EOF) {s=a+b; printf("%d\n",s);} return 1; } 心得:此代码不是你输入了2个数它直接输出和就可以啦。它得要你只要输入了2个数,它就必须输出和。这时,不能马上结束,那么我就想到了ctrl+z作为结束。原创 2014-01-25 11:21:32 · 447 阅读 · 0 评论 -
A+B for Input-Output Practice (II)
#include int main() { int a,b,k,i,s; scanf("%d",&k); for(i=0;i {scanf("%d%d",&a,&b); s=a+b; printf("%d\n",s);} return 1; } 这道题跟上道稍微有些不一样,它需要你在最前方输入一个总数,而不是一直作和下去。这样就需要用到循环。原创 2014-01-25 11:30:08 · 388 阅读 · 0 评论 -
A+B for Input-Output Practice (VI)
#include int main() { int a,k,i,s; { while(scanf("%d",&k)!=EOF) { s=0; for(i=0;i {scanf("%d",&a); s=s+a;} printf("%d\n",s); }} return 1; } 不用讲,这道题简单的想死,前面的稍微删一删原创 2014-01-25 16:34:49 · 512 阅读 · 0 评论 -
A+B for Input-Output Practice (IV)
#include int main() { int a,k,i,s; scanf("%d",&k); while(k!=0) { s=0; for(i=0;i {scanf("%d",&a); s=s+a;} if(k==0)break; printf("%d\n",s); scanf("%d",&k);} return 1;原创 2014-01-25 16:12:03 · 473 阅读 · 0 评论 -
A+B for Input-Output Practice (III)
#include int main() { int a,b,s; while(s!=0) {scanf("%d%d",&a,&b); s=a+b; if(s==0)break; printf("%d\n",s);} return 1; } 这道题得以0+0=0作为结束。我没有做过此类题目。一开始我没有if和break,还用了while(a!=0&&b!=0),结果是原创 2014-01-25 13:38:56 · 420 阅读 · 0 评论 -
A+B for Input-Output Practice (VII)
#include int main() { int a,b,s; while(scanf("%d%d",&a,&b)!=EOF) { s=a+b; printf("%d\n",s); printf("\n"); } return 1; } 这题只是多了一个换一行再输出。原创 2014-01-25 16:42:12 · 364 阅读 · 0 评论 -
A+B for Input-Output Practice (VIII)
#include int main() { int a,n,k,i,j,s; scanf("%d",&k); for(i=0;i {scanf("%d",&n); s=0; for(j=0;j { scanf("%d",&a); s=s+a;} printf("%d\n",s); if(i==(k-1))break; printf原创 2014-01-25 20:29:10 · 2560 阅读 · 0 评论