一个ACM的A+B问题
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/17 17:12:45
一个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写
因为我是初学者,想试试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写
![一个ACM的A+B问题](/uploads/image/z/8120800-64-0.jpg?t=%E4%B8%80%E4%B8%AAACM%E7%9A%84A%2BB%E9%97%AE%E9%A2%98)
# include
int main()
{
int a,b,sum;
scanf("%d%d",&a,&b);//去掉逗号,题目中是以空格分开的
sum=a+b;
printf("%d",sum);
return 0;
}
int main()
{
int a,b,sum;
scanf("%d%d",&a,&b);//去掉逗号,题目中是以空格分开的
sum=a+b;
printf("%d",sum);
return 0;
}