标签:
1.1.1
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int a,b;
while (scanf("%d%d",&a,&b) != EOF)
{
printf("%d\n",a+b);
}
return 0;
}
1.1.2
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int n = 0;
n = scanf("%d",&n);
int a,b = 0;
//int *res = (int *)malloc(n);
for (int i = 0;i < n && scanf("%d%d",&a,&b) != EOF;i++)
{
//res[i] = a+b;
printf("%d",a+b);
}
//for (int i = 0;i < n;i++)
//printf("%d\n",res[i]);
return 0;
}
1.1.3
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int a,b = 0;
while (scanf("%d%d",&a,&b) != EOF && scanf("%d",&a) != 0 && scanf("%d",&b) != 0)
{
printf("%d",a+b);
}
return 0;
}
1.1.4
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
while (scanf("%d",&n) != EOF)
{
if (n == 0)
exit(0);
int sum = 0;
for (int i=0;i<n;i++)
{
int a = 0;
scanf("%d",&a);
sum += a;
}
printf("%d\n",sum );
}
return 0;
}
1.1.5
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int n1 = 0;
while (scanf("%d",&n1) != EOF)
{
for (int i = 0;i < n1;i++)
{
int n2 = 0;
scanf("%d",&n2);
int sum = 0;
for (int j = 0;j < n2;j++)
{
int a = 0;
scanf("%d",&a);
sum += a;
}
printf("%d\n",sum);
}
}
return 0;
}
1.1.6
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int n = 0;
while (scanf("%d",&n) != EOF)
{
for (int i = 0;i < n;i++)
{
int sum = 0;
for (int i = 0;i < n;i++)
{
int a = 0;
scanf("%d",&a);
sum += a;
}
printf("%d\n",sum);
}
}
return 0;
}
1.1.7
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int a,b = 0;
while (scanf("%d%d",&a,&b) != EOF)
{
printf("%d\n\n",a+b);
}
return 0;
}
1.1.8
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
int n1 = 0;
while (scanf("%d",&n1) != EOF)
{
for (int i = 0;i < n1;i++)
{
int n2 = 0;
scanf("%d",&n2);
int sum = 0;
for (int j = 0;j < n2;j++)
{
int a = 0;
scanf("%d",&a);
sum += a;
}
(i<n1-1)?printf("%d\n\n",sum):printf("%d\n",sum);
//最后一次输出不要有空行!
}
}
return 0;
}
acm_hdu ACM Steps Section1(1.1.1-1.1.8)
标签:
原文地址:http://www.cnblogs.com/kimihe/p/4509942.html