codeforces 120A Elevator
2017-11-09 17:21
141 查看
题目链接:传送门。
Input
Output
Examples
Input
Output
【题意】
有一个很奇怪的电梯,有前后两个门和左右两个扶手,现在有一个vip来了,告诉你他上来的状态,然后问你他是左撇子还是右撇子。
【分析】
条件结构,没啥说的,手速题。
【代码】
A sky scraper with 1000 floors has been built in the city of N. It has modern superfast elevators to help to travel from one floor to another. Each elevator has two doors, the front one and the back one. If one goes in through the front door, he goes out through the back one and vice versa. The elevator has two rails numbered with numbers 1 and 2. Rail 1 is located to the left of the entrance to the front door (or correspondingly, to the right of the entrance to the back door). Rail 2 is located opposite it, to the right of the entrance to the front door and to the left of the entrance to the back door. We know that each person in the city of N holds at a rail with the strongest hand. One day a VIP person visited the city and of course, he took a look at the skyscraper and took a ride in the elevator. We know the door through which he entered and the rail he was holding at. Now we need to determine as soon as possible whether he is left-handed or right-handed.
Input
The first line indicates the door through which the very important person entered the elevator. It contains "front" if the person enters the elevator through the front door and "back" if he entered the elevator through the back door. The second line contains integer a (1 ≤ a ≤ 2) which denotes the number of the rail at which the person was holding.
Output
Print character "R" if the VIP is right-handed or "L" if he is left-handed.
Examples
Input
front 1
Output
L
【题意】
有一个很奇怪的电梯,有前后两个门和左右两个扶手,现在有一个vip来了,告诉你他上来的状态,然后问你他是左撇子还是右撇子。
【分析】
条件结构,没啥说的,手速题。
【代码】
#include<bits/stdc++.h> using namespace std; char a[100]; int b; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); scanf("%s%d",a,&b); if(a[0]=='f'&&b==1) puts("L"); else if(a[0]=='f'&&b==2) puts("R"); else if(a[0]=='b'&&b==2) puts("L"); else puts("R"); return 0; }
相关文章推荐
- Codeforces--630E--A rectangle(规律)
- codeforces 702C Cellular Network
- 【CodeForces】【#286】Div.2
- 【CodeForces】708 B. Recover the String 数学构造
- 【Codeforces Round #196 (Div. 1)】Codeforces 338D GCD Table
- 【codeforces 65A】Harry Potter and Three Spells
- CodeForces - 630E A rectangle (数学规律)
- 【离线】【深搜】【树】Codeforces 707D Persistent Bookcase
- codeforces 505C. Mr. Kitayuta, the Treasure Hunter (记忆化搜索)
- CodeForces - 893C Rumor(并查集)
- CodeForces - 666B World Tour(BFS+枚举)
- 【codeforces 190C】STL
- CodeForces 630A:Again Twenty Five!【水题】
- CodeForces 27E
- CodeForces 494A Treasure(字符串匹配 思维)
- CodeForces - 616D 尺取法 two pointer
- CodeForces - 497D Ge 4000 ars
- 【codeforces 810C】Do you want a date?
- Codeforces 593A 2Char
- 【贪心】Codeforces 704B & 705D Ant Man