|
|
вернуться в форум1493 Hello y'all! I don't understand what's wrong with my code.When i tested it on my own it worked perfectly).but when i've sent it, it got WA#3.Can u tell me what's wrong,PLEASE).Here's my code in C++: int sum(long a) { return a/100+(a%100)/10+a%10; } bool islucky(long t) { long t1=t/1000,t2=t%1000,a1=sum(t1),a2=sum(t2); if(a1==a2) return true; else return false; } int main() { long t; cin>>t; long t1,t2; t1=t+1; t2=t-1; if(islucky(t1)||islucky(t2)) { cout<<"Yes"<<endl<<t1<<endl<<t2; } else cout<<"No"; return 0; } |
|
|