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

what is wrong?
Posted by Ashot 1 May 2008 12:54
please say what is wrong
#include <iostream.h>
main()
{
    int n,a,b,c,d,e,f;
    cin>>n;
    f=n%10;
    e=(n/10)%10;
    d=(n/100)%10;
    c=(n/1000)%10;
    b=(n/10000)%10;
    a=(n/100000)%10;
    cout<<a<<endl;
    cout<<b<<endl;
    cout<<c<<endl;
    cout<<d<<endl;
    cout<<e<<endl;
    cout<<f<<endl;
    if((a+b+c)-(d+f+e)==1 || ((a+b+c)-(d+f+e)==-1))
        cout<<"yes";
    else
        cout<<"no";
    return 0;
}

Edited by author 01.05.2008 12:57
Re: what is wrong?
Posted by -AlexandeR- (TNU) 1 May 2008 13:24
try test 123160 and 889789
You don't need to output a,b,c..., only print Yes or No.

Edited by author 01.05.2008 13:28