Problem
Input format
The first line contains `n`. The next `n` lines each contain the employee name, department code, and salary, separated by spaces. - `1 <= n <= 300` - salaries are natural numbers between `1` and `100000` - the department code has between `1` and `15` characters, no spaces - the employee name has at most `30` characters, no spaces - use of `strcmp` and `strcpy` (from `<cstring>`) is permitted
Output format
One line per distinct department, in the order of first appearance, containing the department code and the total salary sum, separated by a space.
Example
5 Maria IT 5000 Ion HR 3000 Ana IT 4500 Dan FIN 6000 Elena HR 3500
IT 9500 HR 6500 FIN 6000
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
5 Maria IT 5000 Ion HR 3000 Ana IT 4500 Dan FIN 6000 Elena HR 3500
IT 9500 HR 6500 FIN 6000
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.