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 1534. Football in Gondor

Show all messages Hide all messages

little solution)) [SPbSU ITMO] Nikolay Makarov 18 Mar 2007 22:44
#include <iostream>
using namespace std;
__int64 min(__int64 x, __int64 y) {
    return (x > y) ? y : x;
}
__int64 val(__int64 x) {
    if (x > 0) return 3;
    if (x == 0) return 1;
    return 0;
}
int main(){
    __int64 k, l, n, t;
    cin >> k >> l >> n;
    t = min(k, n - 1);
    __int64 maxr = 3 * t + n - 1 - t + val(k - t - l);
    t = min(l, n - 1);
    __int64 minr = n - 1 - t + val(k + t - l);
    if (k + t - l == 1 && t >= 1) minr--;// for tests 1 1 3 and 1 1 2, because we change win + lose to 2 draws
    cout << maxr << ' ' << minr;
    return 0;
}
Re: little solution)) Kit 19 Mar 2007 09:34
Yeah, it's nice :)
Re: little solution)) svr 19 Mar 2007 09:44
There is site where most compact and unexpected
C-programs competes.
But I prefer to combine Pascal clearness
and C- libries in some my own style
Re: little solution)) awpris 21 Mar 2007 00:55
Your answer for the test?
1 1 1
...