• acm寒假特辑1月20日 CodeForces


    C - 3 CodeForces - 469A

    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.

    大概题意:两人玩游戏,都有自己不会的关,两人合作能打到n关吗??
    数据量不大,直接模拟。

    //miku saiko
    #include<iostream>
    using namespace std;
    int main()
    {
    	int n, x, a[105] = { 0 }, y, t1, oj = false;
    	a[0] = 1;
    	cin >> n >> x;
    	for (int i = 0; i < x; i++)
    	{cin >> t1; a[t1] = 1;}
    	cin >> y;
    	for (int i = 0; i < y; i++)
    	{cin >> t1; a[t1] = 1;}
    	for (int i = 1; i <= n; i++)//寻找
    	{
    		if (!a[i])
    		{
    			oj = true; break;
    		}
    	}
    	if(oj)
    		cout<< "Oh, my keyboard!" << endl;
    	else
    		cout<< "I become the guy." << endl;
        return 0;
    }
    
    
  • 相关阅读:
    幸福必读
    JAVA程序员之路
    编写数据库操作类,使ASP.NET 中的数据库操作变得简单
    Duwamish 7.0 系列分析文章
    Visual Studio .NET加密技术剖析系列课程
    做为一个Tester,你为Testing付出了多少?
    程序员分成几种不同的境界
    深度探索C++对象模型(2).txt
    Eclipse快速上手指南之使用JUnit
    Eclipse使用技巧
  • 原文地址:https://www.cnblogs.com/gidear/p/10433301.html
Copyright © 2020-2023  润新知