QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 32 MB Puntuación total: 100

#11587. 下午茶

Estadísticas

在访问 Bytic Islands 期间,Byteasar 非常喜欢 Byteans 的民族饮料,即奶茶。这种饮料总是以一种严格确定的方式调制,具体如下:首先,茶杯中装满了一半茶和一半奶的混合物。然后,选择一个由字母 H 和 M 组成的 $n$ 字母仪式词。现在,对于 $i = 1, 2, \dots, n$,执行以下操作:如果仪式词的第 $i$ 个字母是 H,则应喝掉半杯,加入茶直到杯满并搅拌。另一方面,如果该词的第 $i$ 个字母是 M,则执行类似的操作,但加入的是奶而不是茶。在对仪式词的每个字母执行此操作后,剩余的液体被倒掉。

每次 Byteasar 执行仪式时,他都会想知道他喝得更多的是哪种成分:茶还是奶。请帮助 Byteasar 回答这个问题。

输入格式

第一行包含一个整数 $n$ ($1 \leqslant n \leqslant 100\,000$)。第二行包含一个由字母 H 和 M 组成的 $n$ 字母词;这就是 Byteasar 使用的仪式词。

输出格式

如果 Byteasar 喝的茶比奶多,程序应输出单个字母 H;如果他喝的奶比茶多,输出单个字母 M;如果他喝的茶和奶一样多,则输出单词 HM。

样例

输入格式 1

5
HMHHM

输出格式 1

H

说明

Byteasar 总共喝了 $1\frac{37}{64}$ 杯茶和 $\frac{59}{64}$ 杯奶。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.