整理出acm所有題目及答案

整理出acm所有題目及答案

ID:26789643

大小:1.72 MB

頁(yè)數(shù):208頁(yè)

時(shí)間:2018-11-29

整理出acm所有題目及答案_第1頁(yè)
整理出acm所有題目及答案_第2頁(yè)
整理出acm所有題目及答案_第3頁(yè)
整理出acm所有題目及答案_第4頁(yè)
整理出acm所有題目及答案_第5頁(yè)
資源描述:

《整理出acm所有題目及答案》由會(huì)員上傳分享,免費(fèi)在線(xiàn)閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫(kù)。

1、1000A+BProblemProblemDescriptionCalculateA+B.InputEachlinewillcontaintwointegersAandB.Processtoendoffile.?OutputForeachcase,outputA+Binoneline.?SampleInput11?SampleOutput2?AuthorHDOJ代碼:#includeintmain(){inta,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d",a+b

2、);}1001SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n.?208InputTheinputwillconsistofaseriesofintegersn,oneintegerperline.?OutputForeachcase,outputSUM(n)inoneline,followedbyablan

3、kline.Youmayassumetheresultwillbeintherangeof32-bitsignedinteger.?SampleInput1100?SampleOutput15050?AuthorDOOMIII解答:#includemain(){intn,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=0;for(i=0;i<=n;i++)sum+=i;printf("%d",sum);}}2081002A+BProblemIIProblemDes

4、criptionIhaveaverysimpleproblemforyou.GiventwointegersAandB,yourjobistocalculatetheSumofA+B.?InputThefirstlineoftheinputcontainsanintegerT(1<=T<=20)whichmeansthenumberoftestcases.ThenTlinesfollow,eachlineconsistsoftwopositiveintegers,AandB.Noticethattheintegersarever

5、ylarge,thatmeansyoushouldnotprocessthembyusing32-bitinteger.Youmayassumethelengthofeachintegerwillnotexceed1000.?OutputForeachtestcase,youshouldoutputtwolines.Thefirstlineis"Case#:",#meansthenumberofthetestcase.Thesecondlineistheanequation"A+B=Sum",Summeanstheresulto

6、fA+B.Notetherearesomespacesinttheequation.Outputablanklinebetweentwotestcases.?SampleInput212112233445566778899998877665544332211?SampleOutputCase1:1+2=3Case2:112233445566778899+998877665544332211=1111111111111111110?AuthorIgnatius.L?代碼:#include#include

7、ng.h>intmain(){charstr1[1001],str2[1001];intt,i,len_str1,len_str2,len_max,num=1,k;scanf("%d",&t);getchar();while(t--){208inta[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",str

8、2);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;elselen_max=le

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動(dòng)畫(huà)的文件,查看預(yù)覽時(shí)可能會(huì)顯示錯(cuò)亂或異常,文件下載后無(wú)此問(wèn)題,請(qǐng)放心下載。
2. 本文檔由用戶(hù)上傳,版權(quán)歸屬用戶(hù),天天文庫(kù)負(fù)責(zé)整理代發(fā)布。如果您對(duì)本文檔版權(quán)有爭(zhēng)議請(qǐng)及時(shí)聯(lián)系客服。
3. 下載前請(qǐng)仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時(shí)可能由于網(wǎng)絡(luò)波動(dòng)等原因無(wú)法下載或下載錯(cuò)誤,付費(fèi)完成后未能成功下載的用戶(hù)請(qǐng)聯(lián)系客服處理。