【CodeForces】A. I Wanna Be the Guy
来源:互联网 发布:网络博客大全评级 编辑:程序博客网 时间:2024/05/16 10:03
Problem here
Problem
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).
Example
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.
Solution
开一个布尔数组
每次读入都将状态改成true
#include <iostream>#include <vector>using namespace std;int main(){ int n; cin >> n; vector<bool> level; for(int i = 0; i < n; i++){ level.push_back(false); } int x; cin >> x; while(x--){ int tmp; cin >> tmp; level[tmp-1] = true; } int y; cin >> y; while(y--){ int tmp; cin >> tmp; level[tmp-1] = true; } bool succ = true; for(int i = 0; i < level.size(); i++){ if(level[i] == false){ succ = false; } } if(succ){ cout << "I become the guy." << endl; }else{ cout << "Oh, my keyboard!" << endl; } return 0;}
- 【CodeForces】A. I Wanna Be the Guy
- codeforces-#469A. I Wanna Be the Guy(模拟)
- CodeForces 469A. I Wanna Be the Guy(数学)
- Codeforces 469A I Wanna Be the Guy(水题)
- Codeforces 469A I Wanna Be the Guy
- Codeforces I Wanna Be the Guy
- A. I Wanna Be the Guy
- 469A - I Wanna Be the Guy
- CodeForces 469A. I Wanna Be the Guy set简单应用
- CF 469A I Wanna Be the Guy
- I wanna be a DBA
- I don't wanna be in the dark!
- binshenOJ 1215-I Wanna Be A Palindrome (YY)
- kuangbinOJ G I Wanna Be A Palindrome (贪心)
- I wanna a girl
- I Am A Tough Guy
- Make Anonymous be the lucky guy
- I'm the new guy here
- 节点动作
- zzulioj 1730: 通信基站 (全排列&DFS)好题
- 安卓开发中SQLite的使用
- PB中TreeView控件使用技巧
- 【ASP.NET】六大内置对象
- 【CodeForces】A. I Wanna Be the Guy
- HTTP状态码大全
- Can not find the tag library descriptor for "/struts-tags"`
- pycharm激活
- 【OpenGL】透视和ZBuffer
- Java中@Override的作用
- 使用系统文件实现socket通信--客户端搭建
- 51nod 1046 A^B Mod C
- cocos2dx not a valid elf executable libcocos2dcpp.so