预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共75页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

1002A+BProblemII TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):69615AcceptedSubmission(s):12678 ProblemDescription 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 2 12 SampleOutput Case1: 1+2=3 Case2: Author Ignatius.L #include<stdio.h> #include<string.h> intmain(){ charstr1[1001],str2[1001]; intt,i,len_str1,len_str2,len_max,num=1,k; scanf("%d",&t); getchar(); while(t--){ inta[1001]={0},b[1001]={0},c[1001]={0}; scanf("%s",str1); len_str1=strlen(str1); for(i=0;i<=len_str1-1;++i) a[i]=str1[len_str1-1-i]-'0'; scanf("%s",str2); len_str2=strlen(str2); for(i=0;i<=len_str2-1;++i) b[i]=str2[len_str2-1-i]-'0'; if(len_str1>len_str2) len_max=len_str1; else len_max=len_str2; k=0; for(i=0;i<=len_max-1;++i){ c[i]=(a[i]+b[i]+k)%10; k=(a[i]+b[i]+k)/10; } if(k!=0) c[len_max]=1; printf("Case%d:\n",num); num++; printf("%s+%s=",str1,str2); if(c[len_max]==1) printf("1"); for(i=len_max-1;i>=0;--i){ printf("%d",c[i]); } printf("\n"); if(t>=1) printf("\n"); } return0; } 成绩转换 TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others) TotalSubmission(s):25250AcceptedSubmission(s):10776 ProblemDescription 输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下: 90~100为A; 80~89为B; 70~79为C; 60~69为D; 0~59为E; Input 输入数据有多组,每组占一行,由一个整数组成。 Output 对于每组输入数据,输出一行。如果输入数据不在0~100范围内,请输出一行:“Scoreiserror!”。 Sam