#C7353. Score Grading Challenge
Score Grading Challenge
Score Grading Challenge
You are given a list of scores. For each score, apply the following grading rules:
- If the score is a perfect square, i.e., there exists an integer \(k\) such that \(k^2 = score\), then double the score.
- If the score is not a perfect square but is a prime number, triple the score.
- If neither condition applies, leave the score unchanged.
You need to read the number of scores and then the scores from the standard input and output the final graded scores on separate lines.
inputFormat
The first line of the input contains an integer Q
— the number of scores. Each of the following Q
lines contains one integer representing a score.
outputFormat
Output Q
lines. Each line should contain the graded score in the order of the input scores.
4
25
7
18
50
50
21
18
50
</p>