CF1017A.The Rank
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.
There are n students, each of them has a unique id (from 1 to n). Thomas's id is 1. Every student has four scores correspond to his or her English, German, Math, and History scores. The students are given in order of increasing of their ids.
In the table, the students will be sorted by decreasing the sum of their scores. So, a student with the largest sum will get the first place. If two or more students have the same sum, these students will be sorted by increasing their ids.
Please help John find out the rank of his son.
约翰·史密斯知道他的儿子托马斯·史密斯是他班级乃至整所学校中最优秀的学生之一。在学校的学生们完成英语、德语、数学和历史四门科目的考试后,形成了一份成绩表。
共有 n 名学生,每名学生拥有一个唯一的编号(从 1 到 n)。托马斯的编号为 1。每名学生有四个分数,分别对应其英语、德语、数学和历史成绩。表中学生按编号升序排列。
在该成绩表中,学生将按其总分降序排序:总分最高的学生排名第一位。若两名或以上学生总分相同,则这些学生按编号升序排序。
请帮助约翰找出他儿子的排名。
输入格式
The first line contains a single integer n (1≤n≤1000) — the number of students.
Each of the next n lines contains four integers ai, bi, ci, and di (0≤ai,bi,ci,di≤100) — the grades of the i-th student on English, German, Math, and History. The id of the i-th student is equal to i.
第一行包含一个整数 n(1≤n≤1000)—— 学生人数。
接下来的 n 行中,每行包含四个整数 ai、bi、ci 和 di(0≤ai,bi,ci,di≤100)—— 分别表示第 i 位学生在英语、德语、数学和历史四门科目中的成绩。第 i 位学生的编号为 i。
输出格式
Print the rank of Thomas Smith. Thomas's id is 1.
打印托马斯·史密斯的排名。托马斯的编号是 1。
输入输出样例
输入#1
5 100 98 100 100 100 100 100 100 100 100 99 99 90 99 90 100 100 98 60 99
输出#1
2
输入#2
6 100 80 90 99 60 60 60 60 90 60 100 60 60 100 60 80 100 100 0 100 0 0 0 0
输出#2
1
说明/提示
In the first sample, the students got total scores: 398, 400, 398, 379, and 357. Among the 5 students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is 2.
In the second sample, the students got total scores: 369, 240, 310, 300, 300, and 0. Among the 6 students, Thomas got the highest score, so his rank is 1.
在第一个样例中,学生的总分分别为:398、400、398、379 和 357。在 5 名学生中,托马斯与第三名学生并列第二高分,但托马斯的编号更小,因此他的排名为 2。
在第二个样例中,学生的总分分别为:369、240、310、300、300 和 0。在 6 名学生中,托马斯获得最高分,因此他的排名为 1。
输入解题思路,AI测评打分。不知道怎么写?