s3[i]=s1[i-b];
s3[i]='\0';
puts(s3);
return0;
}
10.7YourRideIsHere
Itisawell-knownfactthatbehindeverygoodcometisaUFO.TheseUFOs
oftencometocollectloyalsupportersfromhereonEarth.Unfortunately,
theyonlyhaveroomtopickuponegroupoffollowersoneachtrip.Theydo,
however,letthegroupsknowaheadoftimewhichwillbepickedupfor
eachcometbyacleverscheme:
theypickanameforthecometwhich,along
withthenameofthegroup,canbeusedtodetermineifitisaparticular
group'sturntogo(whodoyouthinknamesthecomets?
).Thedetailsofthe
matchingschemearegivenbelow;yourjobistowriteaprogramwhich
takesthenamesofagroupandacometandthendetermineswhetherthe
groupshouldgowiththeUFObehindthatcomet.
Boththenameofthegroupandthenameofthecometareconvertedintoa
numberinthefollowingmanner:
thefinalnumberisjusttheproductofall
thelettersinthename,whereAis1andZis26.Forinstance,thegroup
USACOwouldbe21*19*1*3*15=17955.Ifthegroup'snumber
mod47isthesameasthecomet'snumbermod47,thenyouneedtotellthe
grouptogetready!
(Rememberthatamodbistheremainderleftover
afterdividingabyb;34mod10is4.)
Writeaprogramwhichreadsinthenameofthecometandthenameofthe
groupandfiguresoutwhetheraccordingtotheaboveschemethenamesare
此文档仅供学习和交流.
此文档收集于网络,如有侵权请联系网站删除amatch,printingGOiftheymatchandSTAYifnot.Thenamesofthe
groupsandthecometswillbeastringofcapitalletterswithnospacesor
punctuation,upto6characterslong.
INPUTFORMAT
Line1:
Anuppercasecharacterstringoflength1..6thatisthenameofthecomet.
Line2:
Anuppercasecharacterstringoflength1..6thatisthenameofthegroup.
COMETQ
HVNGAT
OUTPUTFORMAT
AsinglelinecontainingeitherthewordGOorthewordSTAY.
#include
#include
voidmain()
{
chara[7],b[7];
inti,pa=1,pb=1;
gets(a);
gets(b);