|
|
back to boardHelp!!! I keep WA on test#9 Posted by odp 13 Feb 2005 06:49 #include "stdio.h" #include "stdlib.h" #define ex EOF void recom() { char a,b; a=getchar(); l: if(a==ex) {printf("NO\n");exit(0);} b=getchar(); if(a=='*' && b==')') return; a=b; goto l; } main() { char a,b; int k=0; a=getchar(); while(a!=ex) { b=getchar(); if(a=='(' && b=='*') { recom(); a=getchar(); continue; } if(a=='(') { k++; a=b; continue; } if(a==')') { if(k==0) {printf("NO\n");return 0;} k--; a=b; continue; } if(k!=0 && a!='\n' && a!='\r' && a!='=' && a!='+' && a!='-' && a!='*' && a!='/' && a<'0' && a>'9') {printf("NO\n");return 0;} a=b; } if(k!=0) printf("NO\n"); else printf("YES\n"); } Edited by author 13.02.2005 06:54 Re: Help!!! I keep WA on test#9 Posted by Sandro 14 Feb 2005 18:23 Be careful. Arithmetic expressions can't contain english letters. Try this test: (1+a=2) I got AC Posted by odp 16 Feb 2005 11:04 Thank you!! Edited by author 16.02.2005 12:41 Re: Help!!! I keep WA on test#9 Thanks, got AC now ^_^ |
|
|