A. Neverending competitions
来源:互联网 发布:淘宝直播平台公约 编辑:程序博客网 时间:2024/05/10 16:05
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!
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.
If Jinotega is now at home, print "home" (without quotes), otherwise print "contest".
4SVOSVO->CDGLHR->SVOSVO->LHRCDG->SVO
home
3SVOSVO->HKTHKT->SVOSVO->RAP
contest
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.
解题说明:水题,要么home,要么contest,其实只需要对n进行奇偶判断即可。
#include<stdio.h>int main(){int n;scanf("%d",&n);if(n%2==0)printf("home\n");else printf("contest\n");return 0;}
- A. Neverending competitions
- 【codeforces 765A】Neverending competitions
- CF 397 A. Neverending competitions
- A. Neverending competitions Codeforces Round #397
- Codeforces Round #397(Div. 1 + Div. 2 combined)A. Neverending competitions【水题】
- Is machine learning Kaggle competitions?
- codeforces Gym 101341 K Competitions
- Computer Vision and Machine Learning Competitions
- TopCoder Getting Started in Component Development Competitions(组件开发详细步骤)
- a
- a
- a
- a
- a
- a
- a
- a
- a
- JavaScript函数调用方法、为啥要用apply,call
- 【九度OJ】题目1113:二叉树 解题报告
- Redis 简介
- C#之系统异常处理机制
- 最大连续数列的和
- A. Neverending competitions
- SSL 1589——火车票
- jdbc总结
- 到处是坑,真正的最新版本Andriod JNI Hello World 出炉了!
- 图的最小生成树---克鲁斯卡尔(Kruskal)算法
- java语言基础(13)——运算符基本用法(算数、赋值、比较、逻辑、位运算符)
- 1013. 数素数 (20)
- 编译安装Nginx
- ios--数据的临时保存形式