URI Online Judge | 2027

Noel Bet

By Neilor Tonin, URI BR Brazil

Timelimit: 1

Now is Christmas season, and Rolien and Naej gnomes are doing bets with Santa Claus. Rolien and Noel have 10 seconds to count the ornaments on a Christmas tree. After this, the greatest common divisor of the two numbers counted gives a value greater than 5, Noel wins, otherwise the gnomes win. Well, the problem is that someone change some parts of the gnomos code. Yesterday it was working perfectly but now, it gives a strange error: depending what was chanced, sometimes gives "Presentation Error" sometimes gives "Compilation Error" and sometimes gives "Runtime Error ".

With the changed code below, please fix these few errors and submit the correct the version for Santa Claus.

#include <bits/stdc++.h>

using namespace std;

int GCDsimp (int num, int den) {
	cout << num << den;
	if (den > 0)
		return GCDsimp (den, num % den);
	}
	return num;
}

int main() {
	int num, den, apostas [100], cont=-1;
	while (cin >> num >> den) {
		 apostas[++cont] = GCDsimp (num,den);
		 if  ( apostas[cont] ) > 5)
			cout << "Noel" ;
		 else
			cout << "Gnomos" << endl;
	}
	for (int i=cont; i>0; i++) {
		cout << apostas[cont] << " ";
	}
	return 0;
}
					

Input

The input may have up to 100 test cases. Each test case consists of a line containing two integers separated by a space, representing the number of ornaments counted by the gnomes and Noel respectively for one of the Noel trees.

Output

For each test case you must print a line of output containing "Noel" or "Gnomos", as explained above. In the end, you must print all the values calculated for the 100 bets between gnomes and Noel. Each of the values is followed by a blank space, including the last. Don't forget the end of line of the last line.

Input Sample Output Sample

8 12
9 27
259 111

Gnomos
Noel
Noel
37 9 4