整理出ACM所有题目与答案

整理出ACM所有题目与答案

ID:47422883

大小:1.06 MB

页数:397页

时间:2020-01-10

整理出ACM所有题目与答案_第1页
整理出ACM所有题目与答案_第2页
整理出ACM所有题目与答案_第3页
整理出ACM所有题目与答案_第4页
整理出ACM所有题目与答案_第5页
资源描述:

《整理出ACM所有题目与答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、....1000A+BProblemProblemDescriptionCalculateA+B.InputEachlinewillcontaintwointegersAandB.Processtoendoffile. OutputForeachcase,outputA+Binoneline. SampleInput11 SampleOutput2 AuthorHDOJ.word资料可编辑.....代码:#includeintmain(){inta,b;while(scanf("%d%d",&

2、a,&b)!=EOF)printf("%d",a+b);}1001SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n. InputTheinputwillconsistofaseriesofintegersn,oneintegerperline. .word资料可编辑.....Output

3、Foreachcase,outputSUM(n)inoneline,followedbyablankline.Youmayassumetheresultwillbeintherangeof32-bitsignedinteger. SampleInput1100 SampleOutput15050 AuthorDOOMIII解答:#includemain(){.word资料可编辑.....intn,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=0;for

4、(i=0;i<=n;i++)sum+=i;printf("%d",sum);}}1002A+BProblemIIProblemDescriptionIhaveaverysimpleproblemforyou.GiventwointegersAandB,yourjobistocalculatetheSumofA+B..word资料可编辑..... InputThefirstlineoftheinputcontainsanintegerT(1<=T<=20)whichmeansthenumberoftest

5、cases.ThenTlinesfollow,eachlineconsistsoftwopositiveintegers,AandB.Noticethattheintegersareverylarge,thatmeansyoushouldnotprocessthembyusing32-bitinteger.Youmayassumethelengthofeachintegerwillnotexceed1000. OutputForeachtestcase,youshouldoutputtwolines.Thefi

6、rstlineis"Case#:",#meansthenumberofthetestcase.Thesecondlineistheanequation"A+B=Sum",SummeanstheresultofA+B.Notetherearesomespacesinttheequation.Outputablanklinebetweentwotestcases. SampleInput212112233445566778899998877665544332211 SampleOutputCase1:1+2=3.w

7、ord资料可编辑.....Case2:112233445566778899+998877665544332211=1111111111111111110 AuthorIgnatius.L 代码:#include#includeintmain(){charstr1[1001],str2[1001];intt,i,len_str1,len_str2,len_max,num=1,k;scanf("%d",&t);getchar();while(t--){inta[1001]={0

8、},b[1001]={0},c[1001]={0};scanf("%s",str1);len_str1=strlen(str1);for(i=0;i<=len_str1-1;++i).word资料可编辑.....a[i]=str1[len_str1-1-i]-'0';scanf("%s",str2);len_str2=strlen(str2);for(i=0;i<=len_str2-1

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。