本文主要是介绍ACM- starter,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//输入输出练习
ACM starter
hdu 1.1.1#include<stdlib.h>
#include<stdio.h>int main()
{int a,b;while(scanf("%d %d",&a,&b)==2){printf("%d\n",a+b);}return 0;}
hdu 1.1.2#include<stdlib.h>
#include<stdio.h>int main()
{__int64 a,b,n;scanf("%I64d",&n);while(n--){scanf("%I64d %I64d",&a,&b);printf("%I64d\n",a+b);}return 0;}
hdu 1.1.3#include<stdlib.h>#include<stdio.h>int main(){__int64 a,b,n;while(scanf("%I64d %I64d",&a,&b)==2&&(a||b))//注意ab为零的逻辑{printf("%I64d\n",a+b);}system("pause");return 0;}
hdu 1.1.4#include<stdlib.h>
#include<stdio.h>int main()
{__int64 a,b,n;while(scanf("%I64d",&n )==1&&n){a=0;b=0;while(n--){scanf("%I64d",&a);b+=a;}printf("%I64d\n",b);}return 0;}
hdu1.1.5#include<stdlib.h>
#include<stdio.h>int main()
{__int64 a,b,n,m;scanf("%I64d",&m);while(m--){a=0;b=0;scanf("%I64d",&n );while(n--){scanf("%I64d",&a);b+=a;}printf("%I64d\n",b);} return 0;}
hdu1.1.6#include<stdlib.h>#include<stdio.h>int main(){__int64 a,b,n,m;while(scanf("%I64d",&n)==1){ a=0;b=0;while(n--){scanf("%I64d",&a);b+=a;}printf("%I64d\n",b);}system("pause");return 0;}
hdu1.1.7#include<stdlib.h>#include<stdio.h>int main(){__int64 a,b,n,m;while(scanf("%I64d %I64d",&a,&b)==2){ printf("%I64d\n\n",a+b);}return 0;}
hdu1.1.8#include<stdlib.h>#include<stdio.h>int main(){__int64 a,b,n,m;scanf("%I64d",&m);while(m--){a=0;b=0;scanf("%I64d",&n );while(n--){scanf("%I64d",&a);b+=a;}printf("%I64d\n",b);if(m!=0)printf("\n");} return 0;}
这篇关于ACM- starter的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!