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:WA……HELPIn Reply To:WA……HELP Posted by:mickeyandkaka at 2010-11-12 21:02:00 写了这么多..呃..看着有点晕.. 没必要用这么多if吧..上面定义个数组就行了.. 附上我的AC代码... #include<iostream> using namespace std; int a[27]={0,0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2}; char s[100]; int k; int main() { while (gets(s)!=0) { for (k=0;k<strlen(s);k++) if (a[s[k]-'A'+1]!=0) if (a[s[k]-'A'+1]!=a[s[k+1]-'A'+1]) printf("%d",a[s[k]-'A'+1]); 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