Ihaveaverysimpleproblemforyou.GiventwointegersAandB,yourjobistocalculatetheSumofA+B.
Input
ThefirstlineoftheinputcontainsanintegerT(1<=T<=20)whichmeansthenumberoftestcases.ThenTlinesfollow,eachlineconsistsoftwopositiveintegers,AandB.Noticethattheintegersareverylarge,thatmeansyoushouldnotprocessthembyusing32-bitinteger.Youmayassumethelengthofeachintegerwillnotexceed1000.
Output
Foreachtestcase,youshouldoutputtwolines.Thefirstlineis"Case#:",#meansthenumberofthetestcase.Thesecondlineistheanequation"A+B=Sum",SummeanstheresultofA+B.Notetherearesomespacesinttheequation.Outputablanklinebetweentwotestcases.
SampleInput
212112233445566778899998877665544332211
SampleOutput
Case1:1+2=3Case2:112233445566778899+998877665544332211=1111111111111111110
代码:
importjava.io.BufferedInputStream;importjava.math.BigInteger;importjava.util.Scanner;publicclassMain{publicstaticvoidmain(String[]args){//TODO自动生成的方法存根Scannerstr=newScanner(System.in);intT;T=str.nextInt();inti=1;for(i=1;i<=T;i++){BigIntegera=str.nextBigInteger();BigIntegerb=str.nextBigInteger();System.out.println("Case"+i+":");System.out.println(a+"+"+b+"="+a.add(b));if(i<T){System.out.println("");}}}}