杭电oj语言习题.docx
- 文档编号:24337049
- 上传时间:2023-05-26
- 格式:DOCX
- 页数:25
- 大小:17.62KB
杭电oj语言习题.docx
《杭电oj语言习题.docx》由会员分享,可在线阅读,更多相关《杭电oj语言习题.docx(25页珍藏版)》请在冰豆网上搜索。
杭电oj语言习题
A+BforInput-OutputPractice(I)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
47895 AcceptedSubmission(s):
27036
ProblemDescription
YourtaskistoCalculatea+b.
Tooeasy?
!
Ofcourse!
Ispeciallydesignedtheproblemforacmbeginners.
Youmusthavefoundthatsomeproblemshavethesametitleswiththisone,yes,alltheseproblemsweredesignedforthesameaim.
Input
Theinputwillconsistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline.
Output
Foreachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput.
SampleInput
15
1020
SampleOutput
6
30
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(II)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
36310 AcceptedSubmission(s):
24266
ProblemDescription
YourtaskistoCalculatea+b.
Input
InputcontainsanintegerNinthefirstline,andthenNlinesfollow.Eachlineconsistsofapairofintegersaandb,separatedbyaspace,onepairofintegersperline.
Output
Foreachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput.
SampleInput
2
15
1020
SampleOutput
6
30
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(III)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
43575 AcceptedSubmission(s):
22341
ProblemDescription
YourtaskistoCalculatea+b.
Input
Inputcontainsmultipletestcases.Eachtestcasecontainsapairofintegersaandb,onepairofintegersperline.Atestcasecontaining00terminatestheinputandthistestcaseisnottobeprocessed.
Output
Foreachpairofinputintegersaandbyoushouldoutputthesumofaandbinoneline,andwithonelineofoutputforeachlineininput.
SampleInput
15
1020
00
SampleOutput
6
30
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(IV)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
38758 AcceptedSubmission(s):
20860
ProblemDescription
YourtaskistoCalculatethesumofsomeintegers.
Input
Inputcontainsmultipletestcases.EachtestcasecontainsaintegerN,andthenNintegersfollowinthesameline.Atestcasestartingwith0terminatestheinputandthistestcaseisnottobeprocessed.
Output
Foreachgroupofinputintegersyoushouldoutputtheirsuminoneline,andwithonelineofoutputforeachlineininput.
SampleInput
41234
512345
0
SampleOutput
10
15
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(V)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
28317 AcceptedSubmission(s):
19297
ProblemDescription
Yourtaskistocalculatethesumofsomeintegers.
Input
InputcontainsanintegerNinthefirstline,andthenNlinesfollow.EachlinestartswithaintegerM,andthenMintegersfollowinthesameline.
Output
Foreachgroupofinputintegersyoushouldoutputtheirsuminoneline,andwithonelineofoutputforeachlineininput.
SampleInput
2
41234
512345
SampleOutput
10
15
Author
lcy
A+BforInput-OutputPractice(VI)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
26625 AcceptedSubmission(s):
18072
ProblemDescription
Yourtaskistocalculatethesumofsomeintegers.
Input
Inputcontainsmultipletestcases,andonecaseoneline.EachcasestartswithanintegerN,andthenNintegersfollowinthesameline.
Output
ForeachtestcaseyoushouldoutputthesumofNintegersinoneline,andwithonelineofoutputforeachlineininput.
SampleInput
41234
512345
SampleOutput
10
15
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(VII)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
26675 AcceptedSubmission(s):
17630
ProblemDescription
YourtaskistoCalculatea+b.
Input
Theinputwillconsistofaseriesofpairsofintegersaandb,separatedbyaspace,onepairofintegersperline.
Output
Foreachpairofinputintegersaandbyoushouldoutputthesumofaandb,andfollowedbyablankline.
SampleInput
15
1020
SampleOutput
6
30
Author
lcy
Recommend
JGShining
A+BforInput-OutputPractice(VIII)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
57424 AcceptedSubmission(s):
17576
ProblemDescription
Yourtaskistocalculatethesumofsomeintegers.
Input
InputcontainsanintegerNinthefirstline,andthenNlinesfollow.EachlinestartswithaintegerM,andthenMintegersfollowinthesameline.
Output
Foreachgroupofinputintegersyoushouldoutputtheirsuminoneline,andyoumustnotethatthereisablanklinebetweenoutputs.
SampleInput
3
41234
512345
3123
SampleOutput
10
15
6
Author
lcy
Recommend
JGShining
ASCII码排序
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
50178 AcceptedSubmission(s):
20892
ProblemDescription
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
Input
输入数据有多组,每组占一行,有三个字符组成,之间无空格。
Output
对于每组输入数据,输出一行,字符中间用一个空格分开。
SampleInput
qwe
asd
zxc
SampleOutput
eqw
ads
cxz
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
计算两点间的距离
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
55642 AcceptedSubmission(s):
21268
ProblemDescription
输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。
Input
输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。
Output
对于每组输入数据,输出一行,结果保留两位小数。
SampleInput
0001
0110
SampleOutput
1.00
1.41
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
计算球体积
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
49279 AcceptedSubmission(s):
19553
ProblemDescription
根据输入的半径值,计算球的体积。
Input
输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。
Output
输出对应的球的体积,对于每组输入数据,输出一行,计算结果保留三位小数。
SampleInput
1
1.5
SampleOutput
4.189
14.137
Hint
#definePI3.1415927
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
求绝对值
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
39634 AcceptedSubmission(s):
19548
ProblemDescription
求实数的绝对值。
Input
输入数据有多组,每组占一行,每行包含一个实数。
Output
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。
SampleInput
123
-234.00
SampleOutput
123.00
234.00
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
成绩转换
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
42930 AcceptedSubmission(s):
18877
ProblemDescription
输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下:
90~100为A;
80~89为B;
70~79为C;
60~69为D;
0~59为E;
Input
输入数据有多组,每组占一行,由一个整数组成。
Output
对于每组输入数据,输出一行。
如果输入数据不在0~100范围内,请输出一行:
“Scoreiserror!
”。
SampleInput
56
67
100
123
SampleOutput
E
D
A
Scoreiserror!
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
第几天?
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
41944 AcceptedSubmission(s):
16102
ProblemDescription
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sampleinput,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
SampleInput
1985/1/20
2006/3/12
SampleOutput
20
71
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
求奇数的乘积
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
26716 AcceptedSubmission(s):
17425
ProblemDescription
给你n个整数,求他们中所有奇数的乘积。
Input
输入数据包含多个测试实例,每个测试实例占一行,每行的第一个数为n,表示本组数据一共有n个,接着是n个整数,你可以假设每组数据必定至少存在一个奇数。
Output
输出每组数中的所有奇数的乘积,对于测试实例,输出一行。
SampleInput
3123
42345
SampleOutput
3
15
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
平方和与立方和
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
54199 AcceptedSubmission(s):
16649
ProblemDescription
给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和。
Input
输入数据包含多组测试实例,每组测试实例包含一行,由两个整数m和n组成。
Output
对于每组输入数据,输出一行,应包括两个整数x和y,分别表示该段连续的整数中所有偶数的平方和以及所有奇数的立方和。
你可以认为32位整数足以保存结果。
SampleInput
13
25
SampleOutput
428
20152
Author
lcy
Source
C语言程序设计练习
(一)
Recommend
JGShining
数值统计
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
30733 AcceptedSubmission(s):
16120
ProblemDescription
统计给定的n个数中,负数、零和正数的个数。
Input
输入数据有多组,每组占一行,每行的第一个数是整数n(n<100),表示需要统计的数值的个数,然后是n个实数;如果n=0,则表示输入结束,该行不做处理。
Output
对于每组输入数据,输出一行a,b和c,分别表示给定的数据中负数、零和正数的个数。
SampleInput
60123-10
512340.5
0
SampleOutput
123
005
Author
lcy
Source
C语言程序设计练习
(二)
Recommend
JGShining
求数列的和
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
25164 AcceptedSubmission(s):
15537
ProblemDescription
数列的定义如下:
数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和。
Input
输入数据有多组,每组占一行,由两个整数n(n<10000)和m(m<1000)组成,n和m的含义如前所述。
O
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- oj 语言 习题