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 1530. Ones and Zeroes

what's wrong in my prog?
Posted by m2m 23 Feb 2007 05:04

int main()
{
//    freopen("input.txt", "r", stdin);
    scanf("%d", &n);
    scanf("%s%s", a, b);
    FOR(i, n) a[i]-='0',b[i]-='0';
    REPD(i, n-1, 0) if(a[i]+b[i]==0 && b[i]==0){
        b[i]++;
        REP(j, i+1, n-1)b[j]=0;
        out();
        return 0;
    }
    REPD(i, n-1, 0)if(a[i]==0){
        a[i]=1;
        REP(j, i+1, n-1)a[j]=0;
        ZERO(b);
        out();
        return 0;
    }
    ZERO(a);ZERO(b);
    out();

    return 0;
}