当前位置: 代码迷 >> 综合 >> I Wanna Be the Guy
  详细解决方案

I Wanna Be the Guy

热度:97   发布时间:2023-11-22 14:39:40.0

文章目录

  • 一、 I Wanna Be the Guy
  • 总结


一、 I Wanna Be the Guy

本题链接: I Wanna Be the Guy

题目
A. I Wanna Be the Guy
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
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.

本博客给出本题截图
在这里插入图片描述

题意:如果两个人会的所有level包括了题目中要求的所有level,那就输出I become the guy.,否则输出Oh, my keyboard!

AC代码

#include <iostream>
#include <set>using namespace std;set <int> s;int main()
{
    int n;cin >> n;int p;cin >> p;for (int i = 0; i < p; i ++ ){
    int a;cin >> a;s.insert(a);}int q;cin >> q;for (int i = 0; i < q; i ++ ){
    int a;cin >> a;s.insert(a);}if (s.size() == n)puts("I become the guy.");else puts("Oh, my keyboard!");return 0;
}

总结

水题,不解释