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

HELP,牛人们.WA啊!!

Posted by jiabiao at 2005-09-16 13:09:01 on Problem 2608
#include<stdio.h>
void main()
{
  char str[30];
  int i,j,k;
  while(scanf("%s",str)!=EOF)
     {
        for(i=0;str[i];i++)
          {
            if(str[i]=='B'||str[i]=='F'||str[i]=='P'||str[i]=='V')
               {
                printf("1");
                j=i;
                while(1)
                  {
                    if(str[j]!='B'&&str[j]!='F'&&str[j]!='P'&&str[j]!='V')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
            if(str[i]=='C'||str[i]=='G'||str[i]=='J'||str[i]=='K'||str[i]=='Q'||str[i]=='S'||str[i]=='X'||str[i]=='Z')
               {
                printf("2");
                j=i;
                while(1)
                  {
                    if(str[j]!='C'&&str[j]!='G'&&str[j]!='J'&&str[j]!='K'&&str[j]!='Q'||str[j]!='S'||str[j]!='X'||str[j]!='Z')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
            if(str[i]=='D'||str[i]=='T')
               {
                printf("3");
                j=i;
                while(1)
                  {
                    if(str[j]!='D'&&str[j]!='T')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
            if(str[i]=='L')
               {
                printf("4");
                j=i;
                while(1)
                  {
                    if(str[j]!='L')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
            if(str[i]=='M'||str[i]=='N')
               {
                printf("5");
                j=i;
                while(1)
                  {
                    if(str[j]!='M'&&str[j]!='N')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
            if(str[i]=='R')
               {
                printf("6");
                j=i;
                while(1)
                  {
                    if(str[j]!='R')
                    break;
                    else
                    j++;
                  }
                  i=j;
               }
          }
      printf("\n");
     }
}

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