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 |
What's WA?#include <iostream> #include <string.h> #include <stdlib.h> using namespace std; char temp[200],a[100],b[100],c[100]; int main(){ int i; while(scanf("%s",temp)!=EOF) { if(strcmp(temp,"0+0=0")==0) { printf("True\n");break; } int len=strlen(temp),ai,bi,ci; for(i=len-1,ai=0;i>=0;i--) { if(temp[i]!='='){ a[ai]=temp[i]; ai++; } else{ a[ai]='\0'; ai++; i--; break; } } for(bi=0;i>=0;i--) { if(temp[i]!='+'){ b[bi]=temp[i]; bi++; } else{ b[bi]='\0'; i--;break; } } for(ci=0;i>=0;i--) { c[ci]=temp[i];ci++; } c[ci]='\0'; int tempa,tempb,tempc; tempa=atoi(a);tempb=atoi(b);tempc=atoi(c); if(tempc+tempb==tempa) printf("Ture\n"); else printf("False\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