Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
恩,不错不错,读题和调程序都比以前细心了,1A#include<stdio.h> int main() { int i,max_cnt; char ch; char cnt[26]; //freopen("in.txt","r",stdin); for(i=0;i<26;i++)cnt[i]=0; for(i=0;i<4;i++) while((ch=getchar())!='\n') { if(ch>='A'&&ch<='Z')++cnt[ch-'A']; } for(max_cnt=0,i=0;i<26;i++) { if(cnt[i]>max_cnt)max_cnt=cnt[i]; } while(max_cnt) { int s; for(i=0;i<26;i++) { if(cnt[i]>=max_cnt)s=i; } for(i=0;i<s;i++) { if(cnt[i]>=max_cnt)printf("* "); else printf(" "); } printf("*\n"); --max_cnt; } for(i=0;i<25;i++)printf("%c ",i+'A'); printf("Z\n"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator