|
|
back to boardwhat is wrong in my algo??? Posted by hhh 31 Dec 2008 14:30 #include <iostream> using namespace std; int main() {int n,s1=0,s2=0,i,m,l; cin>>n; m=n;l=n; for(i=0;i<3;i++) {s1+=m%10; m=m/10;} while(m!=0) {s2+=m%10; m=m/10;} if(s1>s2){ if(n%10!=9) cout<<"Yes"; else cout<<"No";} else {if(l%10!=0) cout<<"Yes"; else cout<<"No";} return 0;} |
|
|