QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 2048 MB Puntuación total: 100

#2907. 平均字符

Estadísticas

你有没有想过任意给定字符串的平均 ASCII 字符是什么?没有?从来没有?真的吗?那么,它是字符串中的某个字符,还是其他什么东西呢?

你会用 ASCII 表手工进行这种计算吗?大概不会!所有现代编程语言都包含将 ASCII 字符转换为整数以及将整数转换为 ASCII 字符的函数。当然,这些函数通常也能处理 Unicode 字符,但这不属于本题的范畴。

给定一个由 ASCII 字符组成的字符串,计算其平均字符。如果平均字符位于两个整数 ASCII 值之间,则返回较小的那个。

输入格式

输入包含一行,为一个字符串 $s$ ($1 \le |s| \le 100$),由 ASCII 文本组成。$s$ 中的所有字符均为可打印 ASCII 字符,介于 ASCII 32(空格:' ')和 ASCII 126(波浪号:'~')之间。它不会包含任何控制字符,如回车符、换行符、制表符等。不保证字符串以非空格字符开头、结尾或包含非空格字符。

输出格式

输出一个 ASCII 字符,即 $s$ 中所有 ASCII 字符的平均值。

样例

样例输入 1

ABCDE

样例输出 1

C

样例输入 2

AbCdE

样例输出 2

O

样例输入 3

aBcDe

样例输出 3

V

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.