資源描述:
《杭電題目acm問題詳解.doc》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
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
2、)131096A+BforInput-OutputPractice(VIII)142000ASCII碼排序162001計算兩點間的距離172002計算球體積192003求絕對值202004成績轉(zhuǎn)換212005第幾天?222006求奇數(shù)的乘積242007平方和與立方和262008數(shù)值統(tǒng)計272009求數(shù)列的和282010水仙花數(shù)292011多項式求和312012素數(shù)判定332014青年歌手大獎賽_評委會打分342015偶數(shù)求和362016數(shù)據(jù)的交換輸出382017字符串統(tǒng)計402019數(shù)列有序!412020絕對值排序
3、432021發(fā)工資咯:)452033人見人愛A+B462039三角形482040親和數(shù)49:春杰班級:電商1001學(xué)號:10105041341001SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n.?InputTheinputwillconsistofaseriesofintegersn,one
4、integerperline.?OutputForeachcase,outputSUM(n)inoneline,followedbyablankline.Youmayassumetheresultwillbeintherangeof32-bitsignedinteger.?SampleInput1100?SampleOutput15050?AuthorDOOMIII解答:#includemain(){intn,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=
5、0;for(i=0;i<=n;i++)sum+=i;printf("%d",sum);}}1089A+BforInput-OutputPractice(I)ProblemDescriptionYourtaskistoCalculatea+b.Tooeasy?!Ofcourse!Ispeciallydesignedtheproblemforacmbeginners.Youmusthavefoundthatsomeproblemshavethesametitleswiththisone,yes,allthese
6、problemsweredesignedforthesameaim.?InputTheinputwillconsistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline.?OutputForeachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput.?SampleIn
7、put151020?SampleOutput630?Authorlcy?RecommendJGShining解答:#includemain(){inta,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d",a+b);}1090A+BforInput-OutputPractice(II)ProblemDescriptionYourtaskistoCalculatea+b.?InputInputcontainsanintegerNinthefirstline,
8、andthenNlinesfollow.Eachlineconsistsofapairofintegersaandb,separatedbyaspace,onepairofintegersperline.?OutputForeachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,an