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 |
疯了,怎么老是wa?递推算法有什么地方错了吗?#include "stdio.h" #include "string.h" int main(){ unsigned long a,b,c; long i; char temp[50000],t; for (scanf("%s",temp);temp[0]!='0';scanf("%s",temp)){ for (i=strlen(temp)-2,b=c=1;i>=0;i--){ if (temp[i]=='0') continue; if (temp[i+1]=='0' || 10*temp[i]+temp[i+1]-11*'0'>26) {a=b;c=b;b=a;} else {a=b+c;c=b;b=a;} } printf("%d\n",b); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator