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

#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
#include <iostream>
#include <list>
#include <cstdlib>
#include <bitset>
#define lowbit(x) (x&(-x))
#define lson root<<1,l,mid
#define rson root<<1,mid+1,r
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
using namespace std;
int ans[1100];
char ss[][8] = { "oh!","yeah!" };
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int s, n, m;
		scanf("%d%d%d", &s, &n, &m);
		if (n == m)
			puts("");
		else if (n > m)
		{
			if (n - m > s)
				puts("OMG!");
			else
			{
				for (int i = 0; i < n - m; ++i)
					printf("yeah!%c", " \n"[i == n - m - 1]);
			}
		}
		else
		{
			int cnt = 0;
			int res = 0;
			bool put = 0;
			for (; (n << cnt) < m; ++cnt);
			for (; cnt; --cnt)
			{
				for (; ((n - 1) << cnt) >= m;)
				{
					ans[res++] = 1;
					--n;
				}
				n <<= 1;
				ans[res++] = 0;
			}
			for (; n > m; --n)
			{
				ans[res++] = 1;
			}
			if (res <= s)
				for (int i = 0; i < res; ++i)
					printf("%s%c", ss[ans[i]], " \n"[i == res - 1]);
			else
				puts("OMG!");
		}
	}
//	system("pause");
}