103051: [Atcoder]ABC305 B - ABCDEFG
Description
Score : $200$ points
Problem Statement
There are $7$ points $A$, $B$, $C$, $D$, $E$, $F$, and $G$ on a straight line, in this order. (See also the figure below.)
The distances between adjacent points are as follows.
- Between $A$ and $B$: $3$
- Between $B$ and $C$: $1$
- Between $C$ and $D$: $4$
- Between $D$ and $E$: $1$
- Between $E$ and $F$: $5$
- Between $F$ and $G$: $9$
You are given two uppercase English letters $p$ and $q$. Each of $p$ and $q$ is A
, B
, C
, D
, E
, F
, or G
, and it holds that $p \neq q$.
Find the distance between the points $p$ and $q$.
Constraints
- Each of $p$ and $q$ is
A
,B
,C
,D
,E
,F
, orG
. - $p \neq q$
Input
The input is given from Standard Input in the following format:
$p$ $q$
Output
Print the distance between the points $p$ and $q$.
Sample Input 1
A C
Sample Output 1
4
The distance between the points $A$ and $C$ is $3 + 1 = 4$.
Sample Input 2
G B
Sample Output 2
20
The distance between the points $G$ and $B$ is $9 + 5 + 1 + 4 + 1 = 20$.
Sample Input 3
C F
Sample Output 3
10
Input
题意翻译
数轴上有 $7$ 个点 $A(0),B(3),C(4),D(8),E(9),F(14),G(23)$。 给定**其中两点**,求两点之间的距离。Output
分数:200分
问题描述
在一条直线上有7个点A、B、C、D、E、F和G,按此顺序排列(如图所示)。
相邻点之间的距离如下。
- A和B之间:3
- B和C之间:1
- C和D之间:4
- D和E之间:1
- E和F之间:5
- F和G之间:9
给你两个大写字母p和q。p和q分别是A、B、C、D、E、F或G,且p≠q。
求点p和点q之间的距离。
约束条件
- p和q分别是A、B、C、D、E、F或G。
- p≠q。
输入
输入通过标准输入以以下格式给出:
$p$ $q$
输出
输出点p和点q之间的距离。
样例输入1
A C
样例输出1
4
点A和点C之间的距离为3 + 1 = 4。
样例输入2
G B
样例输出2
20
点G和点B之间的距离为9 + 5 + 1 + 4 + 1 = 20。
样例输入3
C F
样例输出3
10