資源描述:
《杭電acm1004源碼.doc》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、杭電acm1004源碼專業(yè)人士進(jìn)來LettheBalloonRiseTimeLimit:2000/1000MS(Java/Others)????MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):30558????AcceptedSubmission(s):9989ProblemDescriptionContesttimeagain!Howexciteditistoseeballoonsfloatingaround.Buttotellyouasecret,thejudges'favoritetimeisguessingthemostp
2、opularproblem.Whenthecontestisover,theywillcounttheballoonsofeachcolorandfindtheresult.Thisyear,theydecidetoleavethislovelyjobtoyou.?InputInputcontainsmultipletestcases.EachtestcasestartswithanumberN(03、sastringofupto15lower-caseletters.AtestcasewithN=0terminatestheinputandthistestcaseisnottobeprocessed.?OutputForeachcase,printthecolorofballoonforthemostpopularproblemonasingleline.Itisguaranteedthatthereisauniquesolutionforeachtestcase.?SampleInput5greenredblueredred3pinkorangepink0?SampleOutputred
4、pink?#include#includeintmain(){intn,a[1001],i,j,k,m,max;charstr[1001][16],str1[1001][16];while(scanf("%d",&n)!=EOF,n){getchar();scanf("%s",str[0]);a[0]=0;strcpy(str1[0],str[0]);for(i=1,k=1;i=0;j--)if(strcmp(str1[j],str[i])!=0)m++;i
5、f(m==i)strcpy(str1[k++],str[i]);}for(i=0;i