URI ONLINE JUDGE SOLUTION 1366 - Online Judge

Latest

This is an Online Judge Solution Base Site. We can discuss & Solve any contest solution in Programming.

Friday, April 10, 2020

URI ONLINE JUDGE SOLUTION 1366

Problem Number: 1366
Problem Name: Sticks Game
Author’s Name: By Ricardo Anido Brazil
Timelimit: 1
Problem Category: AD-HOC
Problem Source: https://www.urionlinejudge.com.br/judge/en/problems/view/1366

Solution:

#include <iostream>
using namespace std;

int main(int argc, char const *argv[])
{
    int n, x, c, v;

    while(cin >> n && n)
    {
        x = 0;
        for (int i = 0; i < n; ++i)
        {
            cin >> c >> v;
            x += v/2;
        }

        cout << x/2 << endl;
    }
    return 0;
}

No comments:

Post a Comment

Thanks..