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 |
why wa?大哥大姐给点测试数据#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator