博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
J - A + B Problem II(第二季水)
阅读量:5825 次
发布时间:2019-06-18

本文共 1615 字,大约阅读时间需要 5 分钟。

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
 
 
#include
#include
#include
#include
using namespace std;int f(char a[],char b[],int s[]){ int m=strlen(a),n=strlen(b),i,x[1005],y[1005],k; memset(x,0,sizeof(x)); memset(y,0,sizeof(y)); k=max(m,n); if(m==k){ for(i=0;i
=m-n;i--)y[i]=b[n-m+i]-'0'; } if(n==k){ for(i=0;i
=n-m;i--)x[i]=a[m-n+i]-'0'; } s[0]=0; for(i=1;i
=0;i--){ if(s[i]>9){ s[i]-=10; s[i-1]++; } } return k;}int main(){ char a[1005],b[1005]; int n,k=1; cin>>n; while(k<=n){ cin>>a>>b; cout<<"Case "<
<<":"<

 

 格式错误好几次

 

转载地址:http://cqidx.baihongyu.com/

你可能感兴趣的文章
.net excel利用NPOI导入oracle
查看>>
$_SERVER['SCRIPT_FLENAME']与__FILE__
查看>>
hive基本操作与应用
查看>>
html5纲要,细谈HTML 5新增的元素
查看>>
Android应用集成支付宝接口的简化
查看>>
[分享]Ubuntu12.04安装基础教程(图文)
查看>>
django 目录结构修改
查看>>
win8 关闭防火墙
查看>>
CSS——(2)与标准流盒模型
查看>>
MYSQL 基本SQL语句
查看>>
C#中的Marshal
查看>>
linux命令:ls
查看>>
Using RequireJS in AngularJS Applications
查看>>
hdu 2444(二分图最大匹配)
查看>>
【SAP HANA】关于SAP HANA中带层次结构的计算视图Cacultation View创建、激活状况下在系统中生成对象的研究...
查看>>
DevOps 前世今生 | mPaaS 线上直播 CodeHub #1 回顾
查看>>
iOS 解决UITabelView刷新闪动
查看>>
CentOS 7 装vim遇到的问题和解决方法
查看>>
JavaScript基础教程1-20160612
查看>>
ios xmpp demo
查看>>