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 |
Re:到底输出是怎样的啊?In Reply To:到底输出是怎样的啊? Posted by:liuwb at 2007-06-08 12:28:43 这个程序有问题么?老是WA #include <stdio.h> char letter[25]; int a[]={-1,1,2,3,-1,1,2,-1,-1,2,2,4,5,5,-1,1,2,6,2,3,-1,1,-1,2,-1,2}; int main(int argc, char* argv[]) { char *p; int last=-1; while(scanf("%s",letter)!=EOF){ p=letter; while (*p) { if( a[*p-'A']>0 ){ if(a[*p-'A']!=last) { printf("%d",a[*p-'A']); last=a[*p-'A']; } }else{ last=-1; } ++p; } 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