Practice
Screen Time Tracker
2024/Feb/Mar·Variant 2
HARDAlgorithms
Process screen time data for a class of students over 5 days.
For each student:
- Input their name, then 5 daily screen times in minutes (validate each is >= 0).
- Immediately output: their name, total screen time formatted as hours and minutes, and the count of days with > 300 minutes.
After all students, output the class average weekly screen time and the name of the student with the lowest total.
Input: Number of students, then for each student: name then 5 daily minutes. Output: Per-student stats, then class summary.
Example:
Input: 2
Ali
300 310 100 0 0
Sam
400 400 400 400 400
Output: Ali
Screen time 11 hours 50 minutes
Days with more than 300 minutes screen time 1
Sam
Screen time 33 hours 20 minutes
Days with more than 300 minutes screen time 5
Average weekly screen time for class 1355
Lowest weekly time Ali
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Two students, Ali lowest
Inputs: 2, Ali, 300, 310, 100, 0, 0, Sam, 400, 400, 400, 400, 400
Expected: Ali
Screen time 11 hours 50 minutes
Days with more than 300 minutes screen time 1
Sam
Screen time 33 hours 20 minutes
Days with more than 300 minutes screen time 5
Average weekly screen time for class 1355
Lowest weekly time Ali
Test 2: Single student
Inputs: 1, John, 60, 120, 180, 240, 300
Expected: John
Screen time 15 hours 0 minutes
Days with more than 300 minutes screen time 0
Average weekly screen time for class 900
Lowest weekly time John
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade