CF#268 (Div. 2) A.
来源:互联网 发布:数据库系统概论笔记 编辑:程序博客网 时间:2024/05/21 06:29
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?
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.
If they can pass all the levels, print "I become the guy.". If it's impossible, print "Oh, my keyboard!" (without the quotes).
43 1 2 32 2 4
I become the guy.
43 1 2 32 2 3
Oh, my keyboard!
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.
解题思路:
有n个等级,问两个人合作能否全部通过·······
完整代码:
#include <functional>#include <algorithm>#include <iostream>#include <fstream>#include <sstream>#include <iomanip>#include <numeric>#include <cstring>#include <climits>#include <cassert>#include <complex>#include <cstdio>#include <string>#include <vector>#include <bitset>#include <queue>#include <stack>#include <cmath>#include <ctime>#include <list>#include <set>#include <map>using namespace std;#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;typedef double DB;typedef unsigned uint;typedef unsigned long long uLL;/** Constant List .. **/ //{const int MOD = int(1e9)+7;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f3f3f3f3f3f3fLL;const DB EPS = 1e-9;const DB OO = 1e20;const DB PI = acos(-1.0); //M_PI;int vis[10000001];int k;int main(){ #ifdef DoubleQ freopen("in.txt","r",stdin); #endif int n; while(~scanf("%d",&n)) { int q; memset(vis , 0 ,sizeof(vis)); scanf("%d",&q); for(int i = 0 ; i < q ; i ++) { scanf("%d",&k); vis[k] ++; } int p; scanf("%d",&p); if(p == 0 && q == 0) { printf("Oh, my keyboard!\n"); continue; } for(int i = 0; i < p ; i ++) { scanf("%d",&k); vis[k] ++; } int flag = 0; for(int i = 1 ; i <= n ; i ++) if(vis[i] == 0) { flag = 1; break; } if(flag == 1) printf("Oh, my keyboard!\n"); else printf("I become the guy.\n"); }}
- CF#268 (Div. 2) A.
- cf 190div 2 A
- CF #230 (Div. 2) A
- CF#257 (Div. 2) A.
- CF#256 (Div. 2) A.
- CF#FF (Div. 2) A .
- CF#253 (Div. 2) A.
- CF#258 (Div. 2) A.
- CF#252 (Div. 2) A.
- CF#250 (Div. 2) A .
- CF#259 (Div. 2) A.
- CF #260 (Div. 2)A
- CF #261 (Div. 2) A
- CF#264 (Div. 2) A.
- CF #263 (Div. 2) A
- CF #266 (Div. 2) A.
- CF#267 (Div. 2) A
- CF#246 (Div. 2) A.
- Ruby全局变量
- C++实现"类java"代码
- tomcat6和tomcat7的user配置
- 38 Redirect 与RequestDispatcher
- netty权威指南 ---------第三章 入门应用
- CF#268 (Div. 2) A.
- 软件学社第一次培训第一部分
- 海量数据等概率随机抽样-蓄水池算法
- JAVA笔记:JAVA程序控制
- STL--vector 小结
- 解决Android SDK Manager更新、下载速度慢
- Ubuntu下配置samba实现文件夹共享
- C#连接SQL SERVER问题集锦
- Android应用开发:社会化平台登录接入