There is a game called “I Wanna Be the Guy”, consisting of n levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.
Little X can pass only p levels of the game. And Little Y can pass only q levels of the game. You are given the indices of levels Little X can pass and the indices of levels Little Y can pass. Will Little X and Little Y pass the whole game, if they cooperate each other?
Input
The first line contains a single integer n (1 ≤ n ≤ 100).
The next line contains an integer p (0 ≤ p ≤ n) at first, then follows p distinct integers a1, a2, …, ap (1 ≤ ai ≤ n). These integers denote the indices of levels Little X can pass. The next line contains the levels Little Y can pass in the same format. It’s assumed that levels are numbered from 1 to n.
Output
If they can pass all the levels, print "I become the guy.". If it's impossible, print "Oh, my keyboard!" (without the quotes).
Examples
Input
4
3 1 2 3
2 2 4
Output
I become the guy.
Input
4
3 1 2 3
2 2 3
Output
Oh, my keyboard!
Note
In the first sample, Little X can pass levels [1 2 3], and Little Y can pass level [2 4], so they can pass all the levels both.
In the second sample, no one can pass level 4
问题简述:一个游戏有不同的关卡,两个人可以通过不同的关卡,问两人合作能不能通关游戏
问题思路:把出现的1~n进行标记,如果都出现了则打印“I become the guy.\n”;否则打印“Oh, my keyboard!\n”。
#include<cstdio>
#include<iostream>
int a[101];
int main() {
memset(a, 0, sizeof(a));//把数组初始化为0;
int n, x, y, flag = 0;
scanf("%d\n", &n);
scanf("%d ", &x);
for (int i = 0; i < x; i++) {
int temp;//标记,如果输入2,那么a[2]=1;如果输入4,那么a[4]=1。
scanf("%d", &temp);
a[temp] = 1;
}
scanf("%d ", &y);
for (int i = 0; i < y; i++) {
int temp;
scanf("%d", &temp);
a[temp] = 1;
}
for (int i = 1; i <= n; i++) {
if (a[i] == 0) {//判断1~n是否都出现:是则flag++;不是就打印结果跳出循环。
printf("Oh, my keyboard!\n");
break;
}
else flag++;
}
if (flag == n)//如果1~n都出现,那么flag应该等于n。
printf("I become the guy.\n");
return 0;
}