| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 652 人关注过本帖
标题:求A+B的程序总是出现错误,有输入输出案例,求解释what's wrong...
取消只看楼主 加入收藏
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
结帖率:75%
收藏
已结贴  问题点数:5 回复次数:2 
求A+B的程序总是出现错误,有输入输出案例,求解释what's wrong...
#include"stdio.h"
int main()
{
int i,n;
long int a,b;
scanf("%d",&n);
for(i=1;i<n;i++)
{
scanf("%ld%ld",&a,&b);
printf("Case %d:\n",i);
printf("%d+%d=%d",a,b,a+b);
printf("\n");
}
scanf("%ld%ld",&a,&b);
printf("Case%d:\n",n);
printf("%d+%d=%d",a,b,a+b);
return 0;
}





Sample Input
2
1 2
112233445566778899 998877665544332211



Sample Output
Case 1:
1 + 2 = 3

Case 2:
112233445566778899 + 998877665544332211 = 1111111111111111110


提交失败

[ 本帖最后由 yenga 于 2013-11-26 14:03 编辑 ]
搜索更多相关主题的帖子: include return wrong 
2013-11-26 14:01
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
收藏
得分:0 
http://acm.hdu.




Problem Description
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.

 

Input
The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line consists of two positive integers, A and B. Notice that the integers are very large, that means you should not process them by using 32-bit integer. You may assume the length of each integer will not exceed 1000.

 

Output
For each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line is the an equation "A + B = Sum", Sum means the result of A + B. Note there are some spaces int the equation. Output a blank line between two test cases.

 

Sample Input
2
1 2
112233445566778899 998877665544332211
 

Sample Output
Case 1:
1 + 2 = 3

Case 2:
112233445566778899 + 998877665544332211 = 1111111111111111110
2013-11-26 14:11
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
收藏
得分:0 
输出的空格问题我也修改过了,但还是提交不了
2013-11-26 14:11
快速回复:求A+B的程序总是出现错误,有输入输出案例,求解释what's wrong...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.076957 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved