1046 - Game Time - URI Online Judge || URI Online Judge 1046 Game Time Solution

Problem Name: Game Time
Problem Code: 1046
Judge: URI Online Judge
Problem link: 1046 - Game Time
Solution on GitHub: 1046 - Game Time



URI Online Judge 1046 - Game Time Solution in C++/Cpp

#include <iostream>

using namespace std;

void calculation(int x, int y)
{
    int result;
    if (x > 12)
    {
        result = (24 - x) + y;
        cout << "O JAGO DUROU " << result << " HORA(S)" << endl;
    }
    else if (x < y)
    {
        cout << "O JAGO DUROU " << y - x << " HORA(S)" << endl;
    }
    else
    {
        result = 24;
        cout << "O JAGO DUROU " << result << " HORA(S)" << endl;
    }
}

int main()
{
    int a, b;
    cin >> a >> b;
    calculation(a, b);

    return 0;
}





Next Post Previous Post
No Comment
Add Comment
comment url