ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1493. One Step from Happiness

1493
Posted by Devi@nt 2 Jul 2008 04:50
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;
}