A - I Wanna Be the Guy
Problem description
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.",否则输出"Oh, my keyboard!",水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,p,q,x;bool flag=false,used[];
memset(used,false,sizeof(used));
cin>>n>>p;
for(int i=;i<=p;++i){cin>>x;used[x]=true;}
cin>>q;
for(int i=;i<=q;++i){cin>>x;used[x]=true;}
for(int i=;i<=n;++i)
if(!used[i]){flag=true;break;}
if(flag)cout<<"Oh, my keyboard!"<<endl;
else cout<<"I become the guy."<<endl;
return ;
}
A - I Wanna Be the Guy的更多相关文章
- 题目1162:I Wanna Go Home(最短路径问题进阶dijkstra算法))
题目链接:http://ac.jobdu.com/problem.php?pid=1162 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...
- BNUOJ 52308 We don't wanna work! set模拟
题目链接: https://acm.bnu.edu.cn/v3/problem_show.php?pid=52308 We don't wanna work! Time Limit: 60000msM ...
- HDU 5308 I Wanna Become A 24-Point Master(2015多校第二场)
I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 ...
- 2015多校联合训练赛 hdu 5308 I Wanna Become A 24-Point Master 2015 Multi-University Training Contest 2 构造题
I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 ...
- HDU 5308 I Wanna Become A 24-Point Master
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5308 题面: I Wanna Become A 24-Point Master Time Limit ...
- 2015 Multi-University Training Contest 2 hdu 5308 I Wanna Become A 24-Point Master
I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 ...
- When you want to succeed as bad as you wanna breathe, then you’ll be successful.
上周末登了次山,回来就各种矫情犯懒.今天周四一周又要完蛋,我发现自己真的是对时间流逝无可奈何.然后中午看了把小码哥网站还有MJ博客什么的,各种首期班大爆照,心中羞愧无比.年纪大也不能放弃自己啊,要不人 ...
- We don't wanna work!
We don't wanna work! [JAG Asia 2016] 两个set,一个代表工作的,一个代表不工作的 其实是一个很简单的模拟,但是我竟然排序之前标号.... 检查代码的时候要从头开始 ...
- 2016弱校联盟十一专场10.3---We don't wanna work!(STL--set的使用)
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8504#problem/C 代码如下: #include <iostream> # ...
随机推荐
- window 8 电脑操作服务集合(网址)
如何开启Win8远程桌面 http://jingyan.baidu.com/album/48206aeae06627216ad6b3bf.html?picindex=2 Win8.1用户账户的配置管理 ...
- Crossing Rivers UVA - 12230 概率与期望
题目大意:有个人每天要去公司上班,每次会经过N条河,家和公司的距离为D,默认在陆地的速度为1,给出N条河的信息,包括起始坐标p,宽度L,以及船的速度v.船会往返在河的两岸,人到达河岸时,船的位置是随机 ...
- GETDATE()
定义和用法 GETDATE() 函数从 SQL Server 返回当前的时间和日期. 语法 GETDATE() 实例 例子 1 使用下面的 SELECT 语句: SELECT GETDATE() AS ...
- 【剑指Offer】64、滑动窗口的最大值
题目描述: 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值.例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{ ...
- 计蒜客 奇异家庭 (DP)
链接 : Here! 思路 : 首先这棵家族树非常非常非常有特点, 家族里的人要么没有孩子, 要么有两个孩子, 所以这棵家族树是一颗满二叉树. 设定状态 $dp[i][j]$ 为 $i$ 个人组成的不 ...
- idea整合eclipse后快捷键
- salt 批量添加route路由
安装net-tools包 因为其余机器没有网络,使用rpm包安装,并添加缺省路由. [root@web1 base]# tree . ├── add-route.sls ├── files │ └ ...
- 【[Offer收割]编程练习赛11 B】物品价值
[题目链接]:http://hihocoder.com/problemset/problem/1486 [题意] [题解] 设f[i][j]表示前i个物品,每种属性的状态奇偶状态为j的最大价值; 这里 ...
- axios 全攻略之基本介绍与使用(GET 与 POST)
axios axios 是一个基于 Promise 的 HTTP 客户端,专门为浏览器和 node.js 服务 Vue 2.0 官方推荐使用 axios 来代替原来的 Vue request,所以这里 ...
- POJ 3335
/*半平面交求核心的增量法: 假设前N-1个半平面交,对于第N个半平面,只需用它来交前N-1个平面交出的多边形. 算法开始时,调整点的方向为顺时针方向,对于是否为顺时针,只需求出其面积,若为正,必为逆 ...