Tally Construction
Time: 2 s
Memory: 125 MB
Memory: 125 MB
Mr. Crocodile decided to give his students an assignment on tally construction. He gave them \(n \) numbers and some predefined ranges:
\((1-10), (11-20), (21-30), (31-40), (41-50), (51-60), (61-70), (71-80), (81-90), (91-100)\)
Each student must construct a tally based on how many numbers fall into each range.
However, today is a special day — El Clásico, the legendary football match between FC Barcelona and Real Madrid CF, is about to begin. Levi, one of the students, is a huge fan and doesn’t want to miss the kickoff. But he can’t enjoy the match until he completes this task.
The assignment submission time is almost over, and Levi needs your help to quickly construct the tally and ensure he doesn't miss a single moment of the action!
Rules for Tally Construction:
\((1-10), (11-20), (21-30), (31-40), (41-50), (51-60), (61-70), (71-80), (81-90), (91-100)\)
Each student must construct a tally based on how many numbers fall into each range.
However, today is a special day — El Clásico, the legendary football match between FC Barcelona and Real Madrid CF, is about to begin. Levi, one of the students, is a huge fan and doesn’t want to miss the kickoff. But he can’t enjoy the match until he completes this task.
The assignment submission time is almost over, and Levi needs your help to quickly construct the tally and ensure he doesn't miss a single moment of the action!
Rules for Tally Construction:
- For every number in a range, print a `|`.
- For every fifth number in a range, print `*` followed by a space.
- If there are no numbers in a range, print an empty space.
Input
The first line contains an integer n — the number of numbers.The second line contains \(n\) space-separated integers \(a_1, a_2, a_3, ..., a_n\) — the numbers themselves.
Constraint
\(1 \leq n \leq 10^5 \)\(1 \leq a_i \leq 10^2\)
Output
For each predefined range, print the tally as described.Examples
| Input | Output |
|---|---|
|
10
3 13 14 15 16 17 18 48 34 79 |
1 - 10: |
11 - 20: ||||* | 21 - 30: 31 - 40: | 41 - 50: | 51 - 60: 61 - 70: 71 - 80: | 81 - 90: 91 - 100: |
| Input | Output |
|---|---|
|
15
92 4 62 79 45 99 7 11 48 86 20 67 13 87 71 |
1 - 10: ||
11 - 20: ||| 21 - 30: 31 - 40: 41 - 50: || 51 - 60: 61 - 70: || 71 - 80: || 81 - 90: || 91 - 100: || |
Problem Info
| Problem ID | 379 |
| Time Limit | 2000 ms |
| Memory Limit | 128000 KB |
| Moderators | meheraj_hossain_ , tafsiruzzaman , lauhemahfus , refred1 , osama_bq , amirhozaifa , sagorahmedmunna , Dr_KeK , Rakib , fahimcp495 |
Statistics
Submit
You need to Login or Registration for submit your solution