The Accuracy Score
Harborline's sorting centre runs a screening model over every parcel that passes through. A human opens each parcel afterwards, so the team ends up with two labels per parcel: what it really contained, and what the model said. Monday's review always opens with the bluntest question there is — how often was the model simply right?
Task: Print the share of parcels whose two labels agree.
Input
The first line holds an integer n, the number of parcels (1 to 1000). Each of the next n lines holds two values separated by a single space: the true label first, the model's label second. Both are 1 (banned item inside) or 0 (clean).
Output
One line: a number between 0 and 1 with exactly two digits after the decimal point. A flawless week prints 1.00, not 1.
Example:
Input:
4
1 1
0 0
1 0
0 0
Output:
0.75
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in