问题标题:
8个小朋友手拉手站成一圈,从第1个小朋友开始报数,报到3的那位小朋友则出圈,下一个小朋友重新从1开始报数,报到3的出圈,如此循环,直到所有人都出圈为止,请输出这8位小朋友的出
问题描述:
8个小朋友手拉手站成一圈,从第1个小朋友开始报数,报到3的那位小朋友则出圈,下一个小朋友重新从1开始报数,报到3的出圈,如此循环,直到所有人都出圈为止,请输出这8位小朋友的出圈次序。
Pascal
输入10个人的学号和成绩,按照成绩从高分到低分的顺序输出,若成绩相同,则按照学号从小到大的规则输出。
如输入样例为:
891
775
167
485
1578
591
285
1285
378
675
则输出为:
591
891
285
485
1285
378
1578
675
775
167
计算两个分数的和。输入数据时,用四个整数a,b,c,d分别表示两个分数的分子和分母,a和b为第一个数的分子和分母,c和d为第二个数的分子和分母,要求结果为最简分数。如输入1638,则输出1/6+3/8=13/24。
开头是programp1;
var
如果全对,加悬赏,各位帮帮忙,要交作业╮(╯▽╰)╭,谢
开头是programp1;
var
各位大侠是Pascal!!!!!
刘昌孝回答:
Anewcolorwayofthealways-popularNikeSBDunkLowhasbeenspotted,cheapairjordans,withatentativereleasedatescheduledforthenextmonth.YoucangrabapairearlyatKix-Files,though.
Asidefrombringingbackthefattongue,whichitappearsallorplentyofoftheupcomingSBDunkswilldo,thisshoemakeuseofaprovencolorway.Blackleather&suedecometogetherontheupper,butitistheOrangeBlazeaccentworkthatsetsthisshoeapart.OrangeleatherbackstheSwoosh&heelfoxing,&theliner&midsolestitchingalsomakeuseofthebrightorangehue.
AirJordan9Retro“Charcoal”
NikeAirMax24-7Black-MetallicSilver
刘铁柱回答:
adangeroushabit:beforetheloadingchestpockethardobject
manymenliketobeinstalledinthejacketmouthdaily,forexample,cellphone,keys,pensorbusinesscardholderandthelike.Ofcourse,normallythisisnotright,butifinthecar,mayholdthegreatdanger.
,ofcourse,normaldrivingisnothingdangerous.
Butonceanaccident,evenifonlytheemergencybrake,yourbodywillsurelyviolentlyforward,theroleoftheseatbelt,youwillbetightlyreined.Inotherwords,LouisVuittonLVMonogram,seatbeltonyourbody'spressure,andatthistimeifyourcellphonesbeforethechestpocketfilledwithahardobject,itisverylikelytobrutallyharm,suchas:brokenribs.
expertssuggestedthatinordertoavoidsuchaccidents,aslongasthedrivebeforelookingthroughthepockets,thepockets,especiallythechestpocketofthingbefore,especiallyoutofsomehardobject,inthecarcanbeareliableplace,notmuchtimetowaste.
dangeroushabit2:Departmentofhard,lvhandbags,thinandwithametalbeltbuckle
believethateverymanwillbetiedaroundthewaistbelt,Newlvhandbags,butifyoursystemiskindofhard,thin,andabeltwithmetalbuckle,youdriveoutofanaccidentincreaseswhenacertainamountof.Beltislocatedintheabdomen,itisseatbeltthroughtheplace.Whenanaccidentoccurs,slender,withametalbeltbuckleunderintheseatbelt,deeppressuretoyourabdomen,itwillexacerbatedamageyourinternalorgans.
theexpertssuggestthatmeninthecar,especiallytheopenlong-distancetruck,thebestoffhisbelt,beingreplacedwithasoftclothwithaclick.
dangeroushabit3:misplacingdebrisinsidethetrunk
Somemencareless,oftenwillmakeamessofthecar.EspeciallydrivingwagonorMPV,SUV?Becausesuchvehiclestakespaceandluggagecompartmentspaceisconnected,ifyouputjunkbackseat,theluggagecompartmentintoacoverfixedthedebris.Atthispoint,thedangercame.Usuallythecar'sreartrunkspaceistheso-calledHowever,ifthereisaveryfullyourheapincaseofaccidents,mbtshoessale,theimpactoftheseforcesunderdebrisinashorttimewillbecomeaWellawareofyourown.
howtodo?Quicklygetridofthebadhabitsitcluttered.Ifsomethingmustbeplacedinsidethetrunk,remembertousenetswithacertainfixedup.
dangeroushabit4:Theheadorleanoutthewindow
headoutofwindowswhiledrivingwillspit,thisisindividualbehavior.Firstofall,thisbehaviorisuncivilizedandshouldberesisted;andfromthecar'ssafetyitisevenmorecauseforconcern.Inyourheadpokedoutthewindowthemoment,butifspedofffromthenextcarislikelytomakeyourheadhurt.
solvetheaboveproblemissimpletoprepareagarbagebaginthecarwillspitinit,getoffandthenthrowitinthetrash.
相关的主题文章:
如果还可以
尘封的记忆---南聊网事1998
侯超奇回答:
由于本人是C++的,第一题只好用c++写……
思路是用模拟的办法,用boolean数组表示是否报数,
一个指针指向队列并且用一个变量计数,数到3的boolean计数标为1(已报数);如果指针超出了剩下的人数就回到1.C++代码如下
intnum=8,i;
intmap[9]={0,1,2,3,4,5,6,7,8};
boolb[9]={};
while(num>=1)
{
i=1;
while(inum)i=1;
}
b[i]=1;
printf("->%d",map[i]);
num=num-1;
}
第二题就是一个快排,用两个数组分别记录学号和成绩,先对成绩进行快排,注意在调换成绩的时候学号和成绩的位置要一起调整;第二次再快排一遍,在分数相同的部分进行学号的调整(也就是附加一个分数相同的判断)。这样的时间复杂度和编程复杂度适中……
第三题也是可以模拟,先把分母相乘,分子也要呈上相应的数字后相加,得出来的结果除以然后把新的分子和分母用辗转相除法(见参考资料这里不多论述)约去最大公约数;或者是先把分母通分再做,操作次数会增加但是减小了一些数据规模
这种方法要求用的变量数据规模比较大;
点击显示
其它推荐
热门其它推荐