QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 2048 MB 총점: 100

#14924. GPA 计算

통계

Lydia 想知道她是不是毕业生代表!

Lydia 所在的学校按以下方式计算学生的平均绩点(GPA):对于学生修读的每门课程,他们会获得一个从 A 到 E 的字母成绩。A 相当于 4 分,B 相当于 3 分,C 相当于 2 分,D 相当于 1 分,E 相当于 0 分。因此,未加权平均绩点是通过计算这些成绩分数的总和并除以 Lydia 修读的课程数量得到的。

为了计算加权平均绩点,每门课程都被分配了一个从 1 到 3 的等级(tier)。如果学生在 1 等级课程中获得 A、B 或 C,他们将获得 0.05 分的额外加分。如果学生在 2 等级课程中获得 A、B 或 C,他们将获得 0.025 分的额外加分。这是获得额外加分的仅有方式。加权平均绩点是通过将所有额外加分累加到未加权平均绩点上计算得出的。

给定 Lydia 的成绩单,计算她的加权平均绩点!

输入格式

输入的第一行包含一个整数 $n$ ($1 \le n \le 50$)。

接下来的 $n$ 行,每行包含一个双字符字符串,表示 Lydia 修读的其中一门课程的字母成绩,后跟该课程的等级。保证第一个字符在 ABCDE 中,第二个字符在 123 中。

输出格式

输出一个实数,表示 Lydia 的加权平均绩点。如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-6}$,则视为正确。

样例

输入样例 1

5
A1
B2
C3
D1
E2

输出样例 1

2.075

输入样例 2

3
A3
E3
D3

输出样例 2

1.6666666666666667

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.