|
|
back to boardWA test 1 this is my solution #include<iostream> using namespace std; int main() { int n,a,b,c,d,s1=0,s2=0; cin>>n; a=n;
n=a+1; s1+=n%10;n=n/10; s1+=n%10; n=n/10; s1+=n%10;n=n/10;
s2+=n%10;n=n/10; s2+=n%10;n=n/10; s2+=n%10;n=n/10; if(s1==s2)b=1; n=a-1;s1=0;s2=0; if(n==1) cout<<"YES"; else { s1+=n%10;n=n/10; s1+=n%10; n=n/10; s1+=n%10;n=n/10;
s2+=n%10;n=n/10; s2+=n%10;n=n/10; s2+=n%10;n=n/10; if(s1==s2)b=1; } if(b==1)cout<<"YES"; else cout<<"NO"; } |
|
|