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

why wa?大哥大姐给点测试数据

Posted by 415943706 at 2008-08-24 11:59:56 on Problem 2608 and last updated at 2008-08-24 12:04:49
#include<stdio.h>
#include<string.h>

int main()
{
    char cord[21];
    char s1[]="BFPV";
    char s2[]="CGJKQSXZ";
    while (scanf("%s", cord) != EOF)
    {
          for (int i = 0; i < strlen(cord); i++)
          {
               if (strchr(s1,cord[i]) && !(strchr(s1,cord[i-1])))  
                   printf("1");
               else if (strchr(s2,cord[i]) && !(strchr(s2,cord[i-1])))  
                    printf("2");
               else if ((cord[i]=='D'||cord[i]=='T')&&cord[i-1]!='D'&&cord[i-1]!='T')
                    printf("3");
               else if (cord[i]=='L' && cord[i-1]!='L')   
                    printf("4");
               else if ((cord[i]=='M'||cord[i]=='N')&&cord[i-1]!='M'&&cord[i-1]!='N')
                    printf("5");
               else if (cord[i]=='R' && cord[i-1]!='R') 
                    printf("6");                                      
          }    
          printf("\n"); 
    }   
    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