杭电ACM部分题目答案Word下载.docx
- 文档编号:12943010
- 上传时间:2022-09-30
- 格式:DOCX
- 页数:62
- 大小:24.97KB
杭电ACM部分题目答案Word下载.docx
《杭电ACM部分题目答案Word下载.docx》由会员分享,可在线阅读,更多相关《杭电ACM部分题目答案Word下载.docx(62页珍藏版)》请在冰豆网上搜索。
2004成绩转换21
2005第几天?
22
2006求奇数的乘积24
2007平方和与立方和26
2008数值统计27
2009求数列的和28
2010水仙花数29
2011多项式求和31
2012素数判定33
2014青年歌手大奖赛_评委会打分34
2015偶数求和36
2016数据的交换输出38
2017字符串统计40
2019数列有序!
41
2020绝对值排序43
2021发工资咯:
)45
2033人见人爱A+B46
2039三角形48
2040亲和数49
姓名:
郑春杰
班级:
电商1001
学号:
1010504134
1001SumProblem
ProblemDescription
Hey,welcometoHDOJ(HangzhouDianziUniversityOnlineJudge).
Inthisproblem,yourtaskistocalculateSUM(n)=1+2+3+...+n.
Input
Theinputwillconsistofaseriesofintegersn,oneintegerperline.
Output
Foreachcase,outputSUM(n)inoneline,followedbyablankline.Youmayassumetheresultwillbeintherangeof32-bitsignedinteger.
SampleInput
1
100
SampleOutput
5050
Author
DOOMIII
解答:
#include<
stdio.h>
main()
{
intn,i,sum;
sum=0;
while((scanf("
%d"
&
n)!
=-1))
{
for(i=0;
i<
=n;
i++)
sum+=i;
printf("
%d\n\n"
sum);
}
}
1089A+BforInput-OutputPractice(I)
YourtaskistoCalculatea+b.
Tooeasy?
!
Ofcourse!
Ispeciallydesignedtheproblemforacmbeginners.
Youmusthavefoundthatsomeproblemshavethesametitleswiththisone,yes,alltheseproblemsweredesignedforthesameaim.
Theinputwillconsistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline.
Foreachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput.
15
1020
6
30
lcy
Recommend
JGShining
main()
inta,b;
while(scanf("
%d%d"
a,&
b)!
=EOF)
%d\n"
a+b);
1090A+BforInput-OutputPractice(II)
InputcontainsanintegerNinthefirstline,andthenNlinesfollow.Eachlineconsistsofapairofintegersaandb,separatedbyaspace,onepairofintegersperline.
2
#defineM1000
voidmain()
{
inta,b,n,j[M],i;
//printf("
pleaseinputn:
\n"
);
scanf("
n);
n;
b);
%d%d"
a,b);
j[i]=a+b;
i=0;
while(i<
n)
j[i]);
i++;
}
1091A+BforInput-OutputPractice(III)
Inputcontainsmultipletestcases.Eachtestcasecontainsapairofintegersaandb,onepairofintegersperline.Atestcasecontaining00terminatestheinputandthistestcaseisnottobeprocessed.
00
while(!
(a==0&
&
b==0))
1092A+BforInput-OutputPractice(IV)
YourtaskistoCalculatethesumofsomeintegers.
Inputcontainsmultipletestcases.EachtestcasecontainsaintegerN,andthenNintegersfollowinthesameline.Atestcasestartingwith0terminatestheinputandthistestcaseisnottobeprocessed.
Foreachgroupofinputintegersyoushouldoutputtheirsuminoneline,andwithonelineofoutputforeachlineininput.
41234
512345
0
10
15
#include<
intmain()
intn,sum,i,t;
=EOF&
n!
=0)
t);
sum=sum+t;
1093A+BforInput-OutputPractice(V)
Yourtaskistocalculatethesumofsomeintegers.
InputcontainsanintegerNinthefirstline,andthenNlinesfollow.EachlinestartswithaintegerM,andthenMintegersfollowinthesameline.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ACM 部分 题目 答案