Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

一次AC 爽啊 (代码)

Posted by 810974380 at 2009-07-22 15:22:34 on Problem 2136
  爽啊 

#include<stdio.h>
#include<string.h>
int main()
{ char a[300];int i,l,m,n,length,j=0,max=0,b[26];
 for(l=0;l<26;l++)
    b[l]=0;
 while(scanf("%s",a)!=EOF)
 { length=strlen(a);
   for(i=0;i<length;i++)
   { if(a[i]>='A'&&a[i]<='Z')
     (b[a[i]-'A'])++;
   }
 }  max=b[0];
 for(m=0;m<26;m++)
  if(b[m]>max) 
   max=b[m];
  while(max)
  { for(n=0;n<26;n++)
  {if(b[n]==max) {printf("*");
            b[n]--;
	    if(n!=26) printf(" ");}
  else {printf(" ");
        if(n!=26) printf(" ");}
   } printf("\n");
  max--;
  }
  printf("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
  return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator