303756: CF725B. Food on the Plane
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Food on the Plane
题意翻译
**题目描述** 一架新的喷气式飞机有无限行,从驾驶舱到机尾从1开始用正整数编号。每排有六个座位,用字母“a”到“f”表示。座位'a'、'b'、'c'位于过道的左侧(如果有人朝驾驶舱方向看),而座位'd'、'e'、'f'位于右侧。座位'A'和'F'靠近窗户,座位'C'和'D'靠近过道。 现在是午餐时间,两名乘务员刚开始供应食物。他们从第一排移到最后一排,由于他们中间有食物推车,他们总是保持两排的距离。因此,在开始时,第一个服务员服务第1行,而第二个乘务员服务第3行。当两行都完成服务后,它们向前移动一行(第一个乘务员服务第2行,第二个乘务员服务第4行)。然后他们向前移动三行,第一个乘务员服务第5行,第二个服务员服务第7行。然后他们再向前移动一行,以此类推。 乘务员以同样的速度工作:服务一名乘客需要1秒钟,向前移动一排需要1秒钟。每位乘务员首先在过道右侧的座位上为乘客服务,然后在过道左侧的座位上为乘客服务(如果有人朝驾驶舱方向看的话)。此外,从窗口到过道,他们总是按顺序为乘客服务。因此,第一个在每排接收食物的乘客位于“F”座,最后一个在“C”座(假设所有座位都有人)。 Vasya在N排S座,她想知道在她吃午饭前会等多少秒。 **输入格式** 两个数n,s用来表示Vasya座位,其中n是行数,s是该行的座位,表示为字母'a'到'f'。行数和座位之间没有用空格分隔。 **输出格式** 一个整数表示Vasya需要等待多少秒。 **说明** 第一个样例中:第一个乘务员首先为Vasya服务,所以瓦西亚在1秒钟后吃午饭。 第二个样例中:乘务员花费6s为第1行和第3行中的每个人服务,然后他们将在1s内向前移动一行。当他们第一次提供位于过道右侧的座位时,Vasya必须再等3s。总共6+1+3=10s。题目描述
A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with $ 1 $ from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and 'c' are located to the left of an aisle (if one looks in the direction of the cockpit), while seats 'd', 'e' and 'f' are located to the right. Seats 'a' and 'f' are located near the windows, while seats 'c' and 'd' are located near the aisle. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF725B/11aecb9ff1bed50a9df32874ae11bdd3dc69d916.png)It's lunch time and two flight attendants have just started to serve food. They move from the first rows to the tail, always maintaining a distance of two rows from each other because of the food trolley. Thus, at the beginning the first attendant serves row $ 1 $ while the second attendant serves row $ 3 $ . When both rows are done they move one row forward: the first attendant serves row $ 2 $ while the second attendant serves row $ 4 $ . Then they move three rows forward and the first attendant serves row $ 5 $ while the second attendant serves row $ 7 $ . Then they move one row forward again and so on. Flight attendants work with the same speed: it takes exactly $ 1 $ second to serve one passenger and $ 1 $ second to move one row forward. Each attendant first serves the passengers on the seats to the right of the aisle and then serves passengers on the seats to the left of the aisle (if one looks in the direction of the cockpit). Moreover, they always serve passengers in order from the window to the aisle. Thus, the first passenger to receive food in each row is located in seat 'f', and the last one — in seat 'c'. Assume that all seats are occupied. Vasya has seat $ s $ in row $ n $ and wants to know how many seconds will pass before he gets his lunch.输入输出格式
输入格式
The only line of input contains a description of Vasya's seat in the format $ ns $ , where $ n $ ( $ 1<=n<=10^{18} $ ) is the index of the row and $ s $ is the seat in this row, denoted as letter from 'a' to 'f'. The index of the row and the seat are not separated by a space.
输出格式
Print one integer — the number of seconds Vasya has to wait until he gets his lunch.
输入输出样例
输入样例 #1
1f
输出样例 #1
1
输入样例 #2
2d
输出样例 #2
10
输入样例 #3
4a
输出样例 #3
11
输入样例 #4
5e
输出样例 #4
18