Connection Status:
Competition Arena > TestCurve
SRM 276 · 2005-12-08 · by erinn · Math
Class Name: TestCurve
Return Type: int[]
Method Name: determineGrades
Arg Types: (vector<int>)
Problem Statement

Problem Statement

A teacher has graded a test, and you are given a int[] scores representing each student's raw score on the test. The teacher wants to convert the scores into grades such that a raw score of 0 receives a grade of 0, and the highest raw score achieved by any student receives a grade of 100. All other scores in between are calculated proportionally, always rounded down. You are to return a int[] (with the same number of elements as scores) containing the calculated grade for each student. Element i of the return should be the grade for scores[i].

Constraints

  • scores will contain between 1 and 50 elements, inclusive.
  • Each element of scores will be between 0 and 10000, inclusive.
  • At least one element of scores will be greater than 0.
Examples
0)
{15, 27, 8, 33, 19, 50}
Returns: {30, 54, 16, 66, 38, 100 }

Since the highest score is a 50, which gets scaled to a grade of 100, everyone's grade is exactly twice their raw score.

1)
{0, 0, 0, 3}
Returns: {0, 0, 0, 100 }

All but one person did poorly on this test.

2)
{67, 89, 72, 100, 95, 88}
Returns: {67, 89, 72, 100, 95, 88 }

With a highest score of 100, the grade is exactly the raw score.

3)
{1234, 3483, 234, 5738, 3421, 5832, 4433}
Returns: {21, 59, 4, 98, 58, 100, 76 }
4)
{8765}
Returns: {100 }

Submissions are judged against all 73 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class TestCurve with a public method vector<int> determineGrades(vector<int> scores) · 73 test cases · 2 s / 256 MB per case

Submitting as anonymous