资源描述:
《杭电acm部分题目及答案答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、自己刷的题这是我在杭电做题的记录,希望我的分享对你有帮助!!!1001SumProblem***********************************************************21089A+BforInput-OutputPractice(I)********************************41090A+BforInput-OutputPractice(II)********************************61091A+BforInput-OutputPractice(III)***
2、*************************************81092A+BforInput-OutputPractice(IV)********************************91093A+BforInput-OutputPractice(V)********************************111094A+BforInput-OutputPractice(VI)***************************************121095A+BforInput-OutputPractic
3、e(VII)*******************************131096A+BforInput-OutputPractice(VIII)******************************14HowtoType***************************************************************161001SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).Inthispr
4、oblem,yourtaskistocalculateSUM(n)=1+2+3+...+n. InputTheinputwillconsistofaseriesofintegersn,oneintegerperline. OutputForeachcase,outputSUM(n)inoneline,followedbyablankline.Youmayassumetheresultwillbeintherangeof32-bitsignedinteger. SampleInput1100 SampleOutput15050 AuthorDOOM
5、III解答:#includemain(){intn,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=0;for(i=0;i<=n;i++)sum+=i;printf("%d",sum);}}1089A+BforInput-OutputPractice(I)ProblemDescriptionYourtaskistoCalculatea+b.Tooeasy?!Ofcourse!Ispeciallydesignedtheproblemforacmbeginners.Youmusthav
6、efoundthatsomeproblemshavethesametitleswiththisone,yes,alltheseproblemsweredesignedforthesameaim. InputTheinputwillconsistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline. OutputForeachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,and
7、withonelineofoutputforeachlineininput. SampleInput151020 SampleOutput630 Authorlcy RecommendJGShining解答:#includemain(){inta,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d",a+b);}1090A+BforInput-OutputPractice(II)ProblemDescriptionYourtaskistoCalculatea+b. InputInputco
8、ntainsanintegerNinthefirstline,andthenNlinesfollow.Eachlineconsistso