cswork / OA打开练习工作台

UpstartOA #3

Filter by Threshold and Return Name with Max Score

估计简单评测数据准备中,可先阅读题面

考点(AI 标注)原地数组字符串

Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem. Given records records = [(name, score), ...] and an integer threshold: Filter out all records with score > threshold (keep score ≤ threshold). Among the remaining records, find the record with the maximum score and output its name. Constraints At least one record satisfies score ≤ threshold. name is a no-space string, score is an integer. Input: Line 1: integer n Line 2: integer threshold Next n lines: name score Output: One line: the name with the maximum score among those ≤ threshold. Example: Input: 4 80 alice 50 bob 90 cindy 80 dave 70 Output: cindy Example Input 4 80 alice 50 bob 90 cindy 80 dave 70 Output cindy Function Description Complete solveFilterThresholdMaxScore. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.

Constraints

Use the limits and requirements stated in the prompt.