zoukankan      html  css  js  c++  java
  • Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A

    地址:http://codeforces.com/contest/765/problem/A

    题目:

    A. Neverending competitions
    time limit per test
    2 seconds
    memory limit per test
    512 megabytes
    input
    standard input
    output
    standard output

    There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name "snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back.

    Jinotega's best friends, team Base have found a list of their itinerary receipts with information about departure and arrival airports. Now they wonder, where is Jinotega now: at home or at some competition far away? They know that:

    • this list contains all Jinotega's flights in this year (in arbitrary order),
    • Jinotega has only flown from his hometown to a snooker contest and back,
    • after each competition Jinotega flies back home (though they may attend a competition in one place several times),
    • and finally, at the beginning of the year Jinotega was at home.

    Please help them to determine Jinotega's location!

    Input

    In the first line of input there is a single integer n: the number of Jinotega's flights (1 ≤ n ≤ 100). In the second line there is a string of 3capital Latin letters: the name of Jinotega's home airport. In the next n lines there is flight information, one flight per line, in form "XXX->YYY", where "XXX" is the name of departure airport "YYY" is the name of arrival airport. Exactly one of these airports is Jinotega's home airport.

    It is guaranteed that flights information is consistent with the knowledge of Jinotega's friends, which is described in the main part of the statement.

    Output

    If Jinotega is now at home, print "home" (without quotes), otherwise print "contest".

    Examples
    input
    4
    SVO
    SVO->CDG
    LHR->SVO
    SVO->LHR
    CDG->SVO
    output
    home
    input
    3
    SVO
    SVO->HKT
    HKT->SVO
    SVO->RAP
    output
    contest
    Note

    In the first sample Jinotega might first fly from SVO to CDG and back, and then from SVO to LHR and back, so now they should be at home. In the second sample Jinotega must now be at RAP because a flight from RAP back to SVO is not on the list.

     

    思路:因为输入的情况必定合法,所以可以用n的奇偶性判断是home还是contest

     1 #include <bits/stdc++.h>
     2 
     3 using namespace std;
     4 
     5 #define MP make_pair
     6 #define PB push_back
     7 typedef long long LL;
     8 typedef pair<int,int> PII;
     9 const double eps=1e-8;
    10 const double pi=acos(-1.0);
    11 const int K=1e5+7;
    12 const int mod=1e9+7;
    13 
    14 int n;
    15 int main(void)
    16 {
    17     cin>>n;
    18     if(n&1)
    19         printf("contest
    ");
    20     else
    21         printf("home
    ");
    22     return 0;
    23 }

     

  • 相关阅读:
    javaHTTP请求工具类-使用HttpURLConnection实现
    windows 无法启动redis 服务(位于本地计算机上)错误1053 服务没有及时响应启动或控制请求
    Redis 教程
    谢娜离开《快本》103天,暴露了芒果一姐的假相:有一种天真,叫错把平台当本事
    Api 在线文档目录:java8 中文、java11中文
    Linux关闭防火墙命令red hat/CentOs7
    Win10使用RedisDesktopManager工具连接虚拟机(CentOS 7)Redis
    如何win10 上访问虚拟机(linux)上redis方法
    汽车车牌JS正则表达式验证(含新能源车牌)
    vue 直接输入路由地址进入_vue地址栏直接输入路由无效问题
  • 原文地址:https://www.cnblogs.com/weeping/p/6420907.html
Copyright © 2011-2022 走看看