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 |
难道就错在我申请了个全局变量 ? 在线,等答案In Reply To:WA十多次了,我的RP真的有问题吗 ?各位看看,frkstyc你也来帮我看看 Posted by:nuciedh at 2008-04-10 10:44:01 > 这个代码WA了 原因是len是全局变量 ? > #include <stdio.h> > #include <string.h> > > char a[510], len; > > void solve () > { > int i, j; > len = strlen(a); > for (i = 2, j = 2; i < len; ) > { > if(a[i]=='&'||a[i]=='#'||a[i]=='@') i += 2; > else while (a[i] >= 'A' && a[i] <= 'Z') i ++; > > while (a[i]>= '0' && a[i] <= '9') i ++; > if (a[i] == '=') > { > i ++; > while (a[i]>= '0' && a[i] <= '9') i ++; > } > while (j < i) printf ("%c", a[j ++]); > printf ("\n"); > } > } > > int main() > { > > scanf("%s", a); > solve (); > return 0; > } > 下面的AC了: > #include <stdio.h> > #include <string.h> > > char a[510]; > > void solve () > { > int i, j, len; > len = strlen(a); > for (i = 2, j = 2; i < len; ) > { > if(a[i]=='&'||a[i]=='#'||a[i]=='@') i += 2; > else while (a[i] >= 'A' && a[i] <= 'Z') i ++; > > while (a[i]>= '0' && a[i] <= '9') i ++; > if (a[i] == '=') > { > i ++; > while (a[i]>= '0' && a[i] <= '9') i ++; > } > while (j < i) printf ("%c", a[j ++]); > printf ("\n"); > } > } > > int main() > { > > scanf("%s", a); > solve (); > return 0; > } > > Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator