QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100 Hackeable ✓

#9620. osu!mania

Estadísticas

osu! is a globally popular rhythm game with four modes: osu!, osu!taiko, osu!catch, and osu!mania. osu!mania is a falling-note rhythm game, similar to a piano simulator. This mode was primarily developed and ported by woc2006. It is based on various lane-based rhythm games (such as Dance Dance Revolution and Beatmania).

Each game of osu!mania consists of a number of notes. During gameplay, every hit on a note results in a judgment: MAX, 300, 200, 100, 50, or MISS (0). Let $a, b, c, d, e, f$ be the number of notes for which the player received these judgments, respectively. The accuracy (Acc) of the game can be calculated as follows:

$$\text{Acc} = \frac{300a + 300b + 200c + 100d + 50e + 0f}{300(a + b + c + d + e + f)} \times 100\%$$

Since the accuracy may be an infinite decimal, the game displays the rounded result. Specifically, the accuracy for each game is rounded to two decimal places in percentage form, i.e., with a precision of $10^{-4}$.

In addition to accuracy, there is another important metric for measuring performance on a single song in osu!mania: Personal Performance (pp). Personal performance is related to the star rating of the beatmap and the judgment results. The star rating determines the maximum pp that can be obtained on the beatmap, denoted as $\text{ppmax}$. The personal performance obtained by a player in a game can be calculated as follows (the meanings of $a, b, c, d, e, f$ are the same as in the Acc calculation):

$$\text{pp} = \max \left( 0, \frac{320a + 300b + 200c + 100d + 50e + 0f}{320(a + b + c + d + e + f)} - 80\% \right) \times 5 \times \text{ppmax}$$

The personal performance for each game is rounded to the nearest integer.

Given the maximum pp ($\text{ppmax}$) of a beatmap and the player's judgment results $a, b, c, d, e, f$ for a game on that beatmap, calculate the player's accuracy and personal performance.

Input

The input is read from standard input. This problem contains multiple test cases. The first line contains a positive integer $T$, representing the number of test cases. It is guaranteed that $1 \le T \le 100$. For each test case: The first line contains a non-negative integer $\text{ppmax}$. It is guaranteed that $0 \le \text{ppmax} \le 3000$. The second line contains six non-negative integers $a, b, c, d, e, f$, with meanings as described in the problem statement. It is guaranteed that $0 \le a, b, c, d, e, f \le 2 \times 10^4$ and $a + b + c + d + e + f \ge 1$.

Output

Output to standard output. For each test case, output a single line containing two values separated by a space. The first value is the accuracy, output as a percentage with a precision of $10^{-4}$; the second value is the personal performance, output as an integer.

Examples

Input 1

2
630
3029 2336 377 41 10 61
3000
20000 10000 0 0 0 0

Output 1

96.20% 423
100.00% 2688

Note

In the second test case of the example, the accuracy is $100\%$, and the personal performance is:

$$\text{pp} = \max \left( 0, \frac{320 \times 20000 + 300 \times 10000}{320 \times (20000 + 10000)} - 80\% \right) \times 5 \times 3000 = 2687.5 \approx 2688$$

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.