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: 13ms
Memory: 1160kB
Author: 2018212212064
In contest: 1290

#include <cstdio>
#include <cstring>
using namespace std;
int ans[10000];
char ss[][8] = { "oh!","yeah!" };
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int s, n, m;
		int cnt = 0;
		scanf("%d%d%d", &s, &n, &m);
		for (; n != m && s; --s)
		{
			if (m < n || m & 1)
			{
				++m;
				ans[cnt++] = 1;
			}
			else
			{
				m >>= 1;
				ans[cnt++] = 0;
			}
		}
		if (!s && n != m)
			puts("OMG!");
		else
		{
			for (int i = cnt - 1; i >= 0; --i)
				printf("%s%c", ss[ans[i]], " \n"[i == 0]);
		}
	}
//	system("pause");
}