杭电ACM程序文档2.docx
- 文档编号:9166329
- 上传时间:2023-02-03
- 格式:DOCX
- 页数:35
- 大小:33.85KB
杭电ACM程序文档2.docx
《杭电ACM程序文档2.docx》由会员分享,可在线阅读,更多相关《杭电ACM程序文档2.docx(35页珍藏版)》请在冰豆网上搜索。
杭电ACM程序文档2
1002A+BProblemII(大整数加法)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
60902 AcceptedSubmission(s):
11165
ProblemDescription
Ihaveaverysimpleproblemforyou.GiventwointegersAandB,yourjobistocalculatetheSumofA+B.
Input
ThefirstlineoftheinputcontainsanintegerT(1<=T<=20)whichmeansthenumberoftestcases.ThenTlinesfollow,eachlineconsistsoftwopositiveintegers,AandB.Noticethattheintegersareverylarge,thatmeansyoushouldnotprocessthembyusing32-bitinteger.Youmayassumethelengthofeachintegerwillnotexceed1000.
Output
Foreachtestcase,youshouldoutputtwolines.Thefirstlineis"Case#:
",#meansthenumberofthetestcase.Thesecondlineistheanequation"A+B=Sum",SummeanstheresultofA+B.Notetherearesomespacesinttheequation.Outputablanklinebetweentwotestcases.
SampleInput
2
12
112233445566778899998877665544332211
SampleOutput
Case1:
1+2=3
Case2:
112233445566778899+998877665544332211=111111*********1110
1013DigitalRoots(求各位数之和)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
16597 AcceptedSubmission(s):
4705
ProblemDescription
Thedigitalrootofapositiveintegerisfoundbysummingthedigitsoftheinteger.Iftheresultingvalueisasingledigitthenthatdigitisthedigitalroot.Iftheresultingvaluecontainstwoormoredigits,thosedigitsaresummedandtheprocessisrepeated.Thisiscontinuedaslongasnecessarytoobtainasingledigit.
Forexample,considerthepositiveinteger24.Addingthe2andthe4yieldsavalueof6.Since6isasingledigit,6isthedigitalrootof24.Nowconsiderthepositiveinteger39.Addingthe3andthe9yields12.Since12isnotasingledigit,theprocessmustberepeated.Addingthe1andthe2yeilds3,asingledigitandalsothedigitalrootof39.
Input
Theinputfilewillcontainalistofpositiveintegers,oneperline.Theendoftheinputwillbeindicatedbyanintegervalueofzero.
Output
Foreachintegerintheinput,outputitsdigitalrootonaseparatelineoftheoutput.
SampleInput
24
39
0
SampleOutput
6
3
1018BigNumber(求N!
位数)
TimeLimit:
20000/10000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
8735 AcceptedSubmission(s):
3872
ProblemDescription
Inmanyapplicationsverylargeintegersnumbersarerequired.Someoftheseapplicationsareusingkeysforsecuretransmissionofdata,encryption,etc.Inthisproblemyouaregivenanumber,youhavetodeterminethenumberofdigitsinthefactorialofthenumber.
Input
Inputconsistsofseverallinesofintegernumbers.Thefirstlinecontainsanintegern,whichisthenumberofcasestobetested,followedbynlines,oneinteger1≤n≤107oneachline.
Output
Theoutputcontainsthenumberofdigitsinthefactorialoftheintegersappearingintheinput.
SampleInput
2
10
20
SampleOutput
7
19
1019LeastCommonMultiple(最小公倍数)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
9414 AcceptedSubmission(s):
3346
ProblemDescription
Theleastcommonmultiple(LCM)ofasetofpositiveintegersisthesmallestpositiveintegerwhichisdivisiblebyallthenumbersintheset.Forexample,theLCMof5,7and15is105.
Input
Inputwillconsistofmultipleprobleminstances.Thefirstlineoftheinputwillcontainasingleintegerindicatingthenumberofprobleminstances.Eachinstancewillconsistofasinglelineoftheformmn1n2n3...nmwheremisthenumberofintegersinthesetandn1...nmaretheintegers.Allintegerswillbepositiveandliewithintherangeofa32-bitinteger.
Output
Foreachprobleminstance,outputasinglelinecontainingthecorrespondingLCM.Allresultswilllieintherangeofa32-bitinteger.
SampleInput
2
35715
641029693612877921
SampleOutput
105
10296
1020Encoding(字符串编码)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
8570 AcceptedSubmission(s):
3552
ProblemDescription
Givenastringcontainingonly'A'-'Z',wecouldencodeitusingthefollowingmethod:
1.Eachsub-stringcontainingksamecharactersshouldbeencodedto"kX"where"X"istheonlycharacterinthissub-string.
2.Ifthelengthofthesub-stringis1,'1'shouldbeignored.
Input
ThefirstlinecontainsanintegerN(1<=N<=100)whichindicatesthenumberoftestcases.ThenextNlinescontainNstrings.Eachstringconsistsofonly'A'-'Z'andthelengthislessthan10000.
Output
Foreachtestcase,outputtheencodedstringinaline.
SampleInput
2
ABC
ABBCCC
SampleOutput
ABC
A2B3C
2117JustaNumble(小数点后的位数计算)
TimeLimit:
3000/1000MS(Java/Others) MemoryLimit:
32768/32768K(Java/Others)
TotalSubmission(s):
908 AcceptedSubmission(s):
377
ProblemDescription
Nowgiveyoutwointegersnm,youjusttellmethem-thnumberafterradixpointin1/n,forexamplen=4,thefirstnumbleafterpointis2,thesecondis5,andall0followed
Input
Eachlineofinputwillcontainapairofintegersfornandm(1<=n<=10^7,1<=m<=10^5)
Output
Foreachlineofinput,yourprogramshouldprintanumbleonaline,accordingtotheaboverules
SampleInput
42
57
123123
SampleOutput
5
0
8
Author
YBB
Source
HDU2007-10ProgrammingContest_WarmUp
Recommend
威士忌
1197SpecializedFour-DigitNumbers(多进制位运算)
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
1038 AcceptedSubmission(s):
737
ProblemDescription
Findandlistallfour-digitnumbersindecimalnotationthathavethepropertythatthesumofitsfourdigitsequalsthesumofitsdigitswhenrepresentedinhexadecimal(base16)notationandalsoequalsthesumofitsdigitswhenrepresentedinduodecimal(base12)notation.
Forexample,thenumber2991hasthesumof(decimal)digits2+9+9+1=21.Since2991=1*1728+8*144+9*12+3,itsduodecimalrepresentationis1893(12),andthesedigitsalsosumupto21.Butinhexadecimal2991isBAF16,and11+10+15=36,so2991shouldberejectedbyyourprogram.
Thenextnumber(2992),however,hasdigitsthatsumto22inallthreerepresentations(includingBB016),so2992shouldbeonthelistedoutput.(Wedon'twantdecimalnumberswithfewerthanfourdigits-excludingleadingzeroes-sothat2992isthefirstcorrectanswer.)
Input
Thereisnoinputforthisproblem.
Output
Youroutputistobe2992andalllargerfour-digitnumbersthatsatisfytherequirements(instrictlyincreasingorder),eachonaseparatelinewithnoleadingortrailingblanks,endingwithanew-linecharacter.Therearetobenoblanklinesintheoutput.Thefirstfewlinesoftheoutputareshownbelow.
SampleInput
Thereisnoinputforthisproblem.
SampleOutput
2992
2993
2994
2995
2010年10月24日
1061RightmostDigit
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
1817 AcceptedSubmission(s):
739
ProblemDescription
GivenapositiveintegerN,youshouldoutputthemostrightdigitofN^N.
Input
Theinputcontainsseveraltestcases.ThefirstlineoftheinputisasingleintegerTwhichisthenumberoftestcases.Ttestcasesfollow.
EachtestcasecontainsasinglepositiveintegerN(1<=N<=1,000,000,000).
Output
Foreachtestcase,youshouldoutputtherightmostdigitofN^N.
SampleInput
2
3
4
SampleOutput
7
6
Hint
Inthefirstcase,3*3*3=27,sotherightmostdigitis7.
Inthesecondcase,4*4*4*4=256,sotherightmostdigitis6.
Author
Ignatius.L
2035人见人爱A^B
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
1300 AcceptedSubmission(s):
961
ProblemDescription
求A^B的最后三位数表示的整数。
说明:
A^B的含义是“A的B次方”
Input
输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0,B=0,则表示输入数据的结束,不做处理。
Output
对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。
SampleInput
23
126
678910000
00
SampleOutput
8
984
1
Author
lcy
Source
ACM程序设计期末考试(2006/06/07)
Recommend
lcy
1425sort
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
2913 AcceptedSubmission(s):
707
ProblemDescription
给你n个整数,请按从大到小的顺序输出其中前m大的数。
Input
每组测试数据有两行,第一行有两个数n,m(0 Output 对每组测试数据按从大到小的顺序输出前m大的数。 SampleInput 53 3-3592213-644 SampleOutput 213923 Hint Hint 请用VC/VC++提交 Author LL Source ACM暑期集训队练习赛(三) Recommend linle 1205吃糖果 TimeLimit: 6000/3000MS(Java/Others) MemoryLimit: 2000/1000K(Java/Others) TotalSubmission(s): 1383 AcceptedSubmission(s): 443 ProblemDescription HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完? 请你写个程序帮忙计算一下。 Input 第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0 Output 对于每组数据,输出一行,包含一个"Yes"或者"No"。 SampleInput 2 3 411 5 54321 SampleOutput No Yes Hint Hint Pleaseusefunctionscanf Author Gardon Source Gardon-DYGG'scontest2 Recommend JGShining 1106排序 TimeLimit: 2000/1000MS(Java/Others) MemoryLimit: 65536/32768K(Java/Others) TotalSubmission(s): 12778 AcceptedSubmission(s): 3083 ProblemDescription 输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ACM 程序 文档