作业帮 > 综合 > 作业

一个ACM的A+B问题

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/25 01:45:03
一个ACM的A+B问题
因为我是初学者,想试试ACM,但是A+B就wrong answer了
Problem Description
Calculate A + B .
Input
Each line will contain two integers A and B .Process to end of file.
Output
For each case,output A + B in one line.
Sample Input
1 1
Sample Output
2
下面是我写的
# include
int main()
{
int a,b,sum;
scanf("%d,%d",&a,&b);
sum=a+b;
printf("%d",sum);
return 0;
}
为什么会wrong呢,那该怎么写呢,用C写
# include
int main()
{
int a,b,sum;
scanf("%d%d",&a,&b);//去掉逗号,题目中是以空格分开的
sum=a+b;
printf("%d",sum);
return 0;
}