102430: [AtCoder]ABC243 A - Shampoo
Description
Score : $100$ points
Problem Statement
Three people live in Takahashi's house: Takahashi, his father, and his mother. All of them wash their hair in the bathroom each night.
His father, his mother, and Takahashi take a bath in this order and use $A$, $B$, and $C$ milliliters of shampoo, respectively.
This morning, the bottle contained $V$ milliliters of shampoo. Without refilling, who will be the first to run short of shampoo to wash their hair?
Constraints
- $1 \leq V,A,B,C \leq 10^5$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
$V$ $A$ $B$ $C$
Output
If the first person to run short of shampoo to wash their hair is Takahashi's father, print F
; if it is Takahashi's mother, print M
; if it is Takahashi, print T
.
Sample Input 1
25 10 11 12
Sample Output 1
T
Now, they have $25$ milliliters of shampoo.
- First, Takahashi's father uses $10$ milliliters, leaving $15$.
- Next, Takahashi's mother uses $11$ milliliters, leaving $4$.
- Finally, Takahashi tries to use $12$ milliliters and runs short of shampoo since only $4$ is remaining.
Sample Input 2
30 10 10 10
Sample Output 2
F
Now, they have $30$ milliliters of shampoo.
- First, Takahashi's father uses $10$ milliliters, leaving $20$.
- Next, Takahashi's mother uses $10$ milliliters, leaving $10$.
- Then, Takahashi uses $10$ milliliters, leaving $0$.
- Next day, Takahashi's father tries to use $10$ milliliters and runs short of shampoo since only $0$ is remaining.
Sample Input 3
100000 1 1 1
Sample Output 3
M
Input
题意翻译
F,M,T 三个人从 F 开始轮流喝水。瓶中原有 $v$ 毫升水, F,M,T 三个人每次分别都会喝 $a,b,c$ 毫升。求到哪个人的时候水不够喝了?(**注:刚好喝完不算**)Output
分数:100分
问题描述
高桥家里住着三个人:高桥、他的爸爸和妈妈。他们每晚都会在浴室洗头。
他的爸爸、妈妈和高桥按照这个顺序洗澡,分别使用$A$、$B$和$C$毫升的洗发水。
今天早上,瓶子里装有$V$毫升的洗发水。如果不重新填充,谁会是第一个洗头洗到没有洗发水的人呢?
约束
- $1 \leq V,A,B,C \leq 10^5$
- 输入中的所有值都是整数。
输入
输入将从标准输入中给出以下格式:
$V$ $A$ $B$ $C$
输出
如果第一个洗头洗到没有洗发水的人是高桥的爸爸,打印F
;如果高桥的妈妈,打印M
;如果高桥,打印T
。
样例输入1
25 10 11 12
样例输出1
T
现在,他们有25毫升的洗发水。
- 首先,高桥的爸爸使用10毫升,剩下15毫升。
- 接下来,高桥的妈妈使用11毫升,剩下4毫升。
- 最后,高桥尝试使用12毫升洗发水,但是洗发水不够了,因为只剩下4毫升了。
样例输入2
30 10 10 10
样例输出2
F
现在,他们有30毫升的洗发水。
- 首先,高桥的爸爸使用10毫升,剩下20毫升。
- 接下来,高桥的妈妈使用10毫升,剩下10毫升。
- 然后,高桥使用10毫升,剩下0毫升。
- 第二天,高桥的爸爸尝试使用10毫升洗发水,但是洗发水不够了,因为只剩下0毫升了。
样例输入3
100000 1 1 1
样例输出3
M