#C9152. Filter Students by Physics Score
Filter Students by Physics Score
Filter Students by Physics Score
You are given a list of students with their math and physics scores. Your task is to filter and output the students whose physics score is strictly greater than a given threshold. Each student record contains the following fields:
- name: The student's name
- math_score: The student's math score
- physics_score: The student's physics score
The filtering condition can be mathematically expressed as \(physics\_score > threshold\).
If no student meets the condition, output an empty array.
inputFormat
The input is given via standard input with the following format:
- The first line contains an integer (N) which represents the number of students.
- The next (N) lines each contain a student's information: a string name (without spaces), an integer math_score, and an integer physics_score separated by spaces.
- The last line contains an integer representing the threshold for physics scores.
outputFormat
Output to standard output a JSON array of student records (in the same order as input) whose physics score is strictly greater than the threshold. Each record should be a JSON object with keys: name
, math_score
, and physics_score
. If no student meets the condition, output an empty JSON array (i.e., []).## sample
3
John 50 80
Emily 90 95
Bob 60 70
75
[{"name": "John", "math_score": 50, "physics_score": 80}, {"name": "Emily", "math_score": 90, "physics_score": 95}]