资源描述:
《部分ACM题目与答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1001SumProblem21089A+BforInput-OutputPractice(I)41090A+BforInput-OutputPractice(II)61091A+BforInput-OutputPractice(III)81092A+BforInput-OutputPractice(IV)91093A+BforInput-OutputPractice(V)111094A+BforInput-OutputPractice(VI)121095A+BforInput-OutputPractice(VII)13109
2、6A+BforInput-OutputPractice(VIII)142000ASCII码排序162001计算两点间的距离172002计算球体积192003求绝对值202004成绩转换212005第几天?222006求奇数的乘积242007平方和与立方和262008数值统计272009求数列的和282010水仙花数292011多项式求和312012素数判定332014青年歌手大奖赛_评委会打分342015偶数求和362016数据的交换输出382017字符串统计402019数列有序!412020绝对值排序432021发工资咯:)
3、452033人见人爱A+B462039三角形482040亲和数491001SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n. InputTheinputwillconsistofaseriesofintegersn,oneintegerperline. OutputForeachcase,outputSUM
4、(n)inoneline,followedbyablankline.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);}}
5、1089A+BforInput-OutputPractice(I)ProblemDescriptionYourtaskistoCalculatea+b.Tooeasy?!Ofcourse!Ispeciallydesignedtheproblemforacmbeginners.Youmusthavefoundthatsomeproblemshavethesametitleswiththisone,yes,alltheseproblemsweredesignedforthesameaim. InputTheinputwillcon
6、sistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline. OutputForeachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput. SampleInput151020 SampleOutput630 Authorlcy RecommendJGShining解答:#inc
7、ludemain(){inta,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d",a+b);}1090A+BforInput-OutputPractice(II)ProblemDescriptionYourtaskistoCalculatea+b. InputInputcontainsanintegerNinthefirstline,andthenNlinesfollow.Eachlineconsistsofapairofintegersaandb,separate
8、dbyaspace,onepairofintegersperline. OutputForeachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforea