7.2 Virat’s Gaming Tournament Boost
Virat is participating in an online gaming tournament where players earn points in 6 different rounds.
His current points in each round are: P1, P2, P3, P4, P5, P6.
To qualify for the finals, his average score must be at least 8.
Virat can use a special “Power Boost” to make a round’s score exactly 10.
Each boost costs 50 coins, and he can use it on any number of rounds.
Your task is to calculate the minimum number of coins Virat must spend to ensure he qualifies.
Constraints
1≤T≤10^4 — number of test cases.
Each test case contains 6 integers P1,P2,P3,P4,P5,P6
0≤Pi≤100 for every i
Input Format
The first line contains an integer T, the number of test cases.
Each of the next T lines contains 6 integers: P1 P2 P3 P4 P5 P6.
Output Format
For each test case, print a single integer — the minimum coins Virat needs to spend.
Example 1
Input:
3
8 8 8 8 8 8
5 7 9 6 8 5
0 0 0 0 0 0
Output:
0
100
250
Explanation:
Test Case 1: Total = 48 → Avg = 8 → No boost needed → 0 coins
Test Case 2: Total = 40 → Needs at least 48 → Boost 5→10 (+5) and 6→10 (+4) → new total = 49 → 2 boosts → 2 × 50 = 100 coins
Test Case 3: Boost 5 out of 6 rounds from 0→10 to cover the 48-point deficit, costing 5 × 50 = 250 coins.
Log In to solve the Question