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 2035. Another Dress Rehearsal

Time error
Posted by Levan 13 Oct 2015 20:16
How do it more fast?

#include <iostream>
using namespace std;

int main()
{
    int x, y, c;

    cin >> x >> y >> c;

    if((x + y) < c)
    {
        cout << "Impossible" << endl;
    }
    else
    {
        for(int i = 0; i <= x; i++)
        {
            for(int j = 0; j <= y; j++)
            {
                if((i + j) == c)
                {
                    cout << i << " " << j << endl;
                    return 0;
                }
            }
        }
    }
}

Edited by author 13.10.2015 20:23

Edited by author 13.10.2015 20:23
Re: Time error
Posted by Daniil 20 Apr 2016 18:08
Here is other way to solve
If U have X u do not need finding Y

Edited by author 20.04.2016 18:25