资源描述:
《华南农业大学 2009 ACM题目》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、6754 KeyboardofaMobileTelephone时间限制:500MS 内存限制:1000K提交次数:0通过次数:0题型:编程题 语言:无限制描述Nowalmosteverystudenthasamobiletelephone.Butdoyouhavemakingattentiontothekeyboardofamobiletelephone?Thisisthekeyboardofanormalmobiletelephone:Itwillshowdifferentlettersifyoupressonekeydifferenttimes,forexampleyoup
2、ressthekey“2”onceitwillshowaletter‘a’,twiceshowa‘b’.Andnoticethatpressthekey‘0’oncewillshowaspace.Nowgiveyouasentence,whichcontainsonlylowercasesandspace,calculatehowmuchtimestopressthekeyboardatleasttoshowthesentence.InputThefirstlinecontainsanintegern,whichmeansthenumberofcases.Percaseconsis
3、tofonlyonesentence,whichcontainsonlylowercasesandspacesanditslengthlessorequal200.OutputPercaseoutputaninteger,whichistheleasttimestopressthekeyboard,inoneline.SampleInput1thisproblemissoeasySampleOutput53SourceByHanqiu6755 Right-angledTriangle时间限制:612MS 内存限制:1000K提交次数:0通过次数:0题型:编程题 语言:无限制描述
4、Right-angledtriangleisveryimportantinplanegeometry,justastheprimesinnumeralsystem.Nowthereisaninterestingproblemaboutright-angledtriangle.Asweallknow,ifwechoosethreepointsinacoordinatesystemandthesepointsaccordingtosomeconditions,theycanformaright-angledtriangle.Andthereisanexampleinthepicture
5、:the△OPQformsaright-angledtriangle.Ifgiveaintegern,therearemanywaystochoosetwopointsthataccordingthreecondition:1)eachco-ordinateisinteger2)liesbetween0andninclusive,thatis0<=x1,y1,x2,y2<=n,3)thetwopointsandtheoriginpointcanformaright-angledtriangle.Andthefollowingpictureisoneexamplewhichn=2,a
6、nditshowsthatthereare14differentwaystochoosetwopointstoformsaright-angledtrianglewithoriginpointAndthisistheproblem,giveyouaintegern,youshouldcalculatehowmanywaystochoosetwodifferentpoints,bothsatisfythethreeconditionsabove.InputThefirstlineofinputisanintegerm(2<=m<=20),whichspecifiesthenumber
7、ofcasetofollow.Eachcaseperline,containsonlyoneintegern(2<=n<=50).OutputPercaseoutputaninteger,whichisthewaytochoosethosetwopointsandpercaseoneline.SampleInput223SampleOutput1433SourceByHanqiu6756 WarAtTrafalgar时间限制:500MS 内存限制:1000K提交次数: