Start: Jun, 30, 2019 09:00:00
2019年度暑期短学期第十天 助教场
End: Jul, 08, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 8ms
Memory: 5664kB
Author: 2018212212246
In contest: 1290

#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int MAXN = 1e6 + 6;
int a[MAXN];
int main() 
{
	int T;
	cin >> T;
	while (T--) 
	{
		int s, n, m, pos = 0;
		cin >> s >> n >> m;
		while (n != m) 
		{
			if (n > m) 
			{
				m++;
				a[pos++] = 1;
			}
			else 
			{
				if (m % 2 == 1) 
				{
					m++;
					a[pos++] = 1;
				}
				else 
				{
					m /= 2;
					a[pos++] = 2;
				}
			}
		}
		if (pos <= s)
		{
			for (int i = pos-1; i >= 0; i--)
			{
				if (a[i] == 1)
					cout << "yeah! ";
				else
					cout << "oh! ";
			}
			cout << endl;
		}
		else
			cout << "OMG!" << endl;
	}
	return 0;
}