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: 7ms
Memory: 2148kB
Author: 2018212212155
In contest: 1290

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cmath>
using namespace std;
int T,s,n,m,i,a[100010],f;
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&s,&n,&m);
		f=0;
		while(n!=m){
			if(m>n){
				if(m%2==1){
					a[f]=1;
					f++;m++;
				}
				else{
					a[f]=2;
					f++;m/=2;
				}
			}
			else{
				a[f]=1;
				f++;m++;
			}
		}
		if(f<=s){
			for(i=f-1;i>=0;i--){
				if(a[i]==1)	printf("yeah! ");
				else	printf("oh! ");
			}
		}
		else	printf("OMG!");
		printf("\n");
	}
}