資源描述:
《整理出acm所有題目附標(biāo)準(zhǔn)答案》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
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);}1001SumProblem
2、ProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n.聞創(chuàng)溝燴鐺險愛氌譴凈。?212/212InputTheinputwillconsistofaseriesofintegersn,oneintegerperline.殘騖樓諍錈瀨濟溆塹籟。?OutputForeachcase,outputSUM(n)inoneline,followedbyablankline.Youmayassumet
3、heresultwillbeintherangeof32-bitsignedinteger.?釅錒極額閉鎮(zhèn)檜豬訣錐。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);}}212/2121002A+BProblemIIProblemDescriptionIhaveaverysimpleproblemf
4、oryou.GiventwointegersAandB,yourjobistocalculatetheSumofA+B.彈貿(mào)攝爾霽斃攬磚鹵廡。?InputThefirstlineoftheinputcontainsanintegerT(1<=T<=20)whichmeansthenumberoftestcases.ThenTlinesfollow,eachlineconsistsoftwopositiveintegers,AandB.Noticethattheintegersareverylarge,thatmeansyoushouldnotprocessthembyusing32-
5、bitinteger.Youmayassumethelengthofeachintegerwillnotexceed1000.?謀蕎摶篋飆鐸懟類蔣薔。OutputForeachtestcase,youshouldoutputtwolines.Thefirstlineis"Case#:",#meansthenumberofthetestcase.Thesecondlineistheanequation"A+B=Sum",SummeanstheresultofA+B.Notetherearesomespacesinttheequation.Outputablanklinebetweent
6、wotestcases.廈礴懇蹣駢時盡繼價騷。?SampleInput212112233445566778899998877665544332211?SampleOutputCase1:1+2=3Case2:112233445566778899+998877665544332211=1111111111111111110?煢楨廣鰳鯡選塊網(wǎng)羈淚。AuthorIgnatius.L?代碼:#include#includeintmain(){charstr1[1001],str2[1001];intt,i,len_str1,len_str2,len_ma
7、x,num=1,k;scanf("%d",&t);212/212getchar();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=