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

还行

Posted by chenjiang at 2009-08-24 14:38:07 on Problem 2136
#include<iostream>
#include<string>

using namespace std;

int main()
{   char ch[73];
    int i,j,len,a[27],b[300][27],max;
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    for(j=1;j<=4;j++)
    {   gets(ch);
        len=strlen(ch);
        for(i=0;i<len;i++)
        {    if(ch[i]=='A')a[1]++;
             if(ch[i]=='B')a[2]++;
             if(ch[i]=='C')a[3]++;
             if(ch[i]=='D')a[4]++;
             if(ch[i]=='E')a[5]++;
             if(ch[i]=='F')a[6]++;
             if(ch[i]=='G')a[7]++;
             if(ch[i]=='H')a[8]++;
             if(ch[i]=='I')a[9]++;
             if(ch[i]=='J')a[10]++;
             if(ch[i]=='K')a[11]++;
             if(ch[i]=='L')a[12]++;
             if(ch[i]=='M')a[13]++;
             if(ch[i]=='N')a[14]++;
             if(ch[i]=='O')a[15]++;
             if(ch[i]=='P')a[16]++;
             if(ch[i]=='Q')a[17]++;
             if(ch[i]=='R')a[18]++;
             if(ch[i]=='S')a[19]++;
             if(ch[i]=='T')a[20]++;
             if(ch[i]=='U')a[21]++;
             if(ch[i]=='V')a[22]++;
             if(ch[i]=='W')a[23]++;
             if(ch[i]=='X')a[24]++;
             if(ch[i]=='Y')a[25]++;
             if(ch[i]=='Z')a[26]++;
        }
    }
    /*
    for(i=1;i<=26;i++)
    {   cout<<a[i]<<" ";
    }cout<<endl;
    */
    
    max=0;
    for(i=1;i<=26;i++)
    {  if(a[i]>max)
       {  max=a[i]; }
    }
    for(i=1;i<=max;i++)
    {   for(j=1;j<=26;j++)
        {   if(a[j]>=i)
            {  b[i][j]=1; }
        }
    }
    for(i=max;i>=1;i--)
    {   for(j=1;j<=26;j++)
        {   if(b[i][j])
            {  cout<<"*"<<" ";  }
            else
            {  cout<<"  ";   }
        }
        cout<<endl;
    }
    for(i='A';i<='Z';i++)
    {  cout<<(char)i<<" ";  }
    cout<<endl;
    
    system("pause");
    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