问题1789--Rank

1789: Rank

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

John Q. Public wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute J.Q.'s rank in class; that is, if he has the top mark (or is tied for the top mark) his rank is 1; if he has the second best mark (or is tied) his rank is 2, and so on.

输入

The input consists of several test cases. Each case begins with J.Q.'s student number, an integer between 1000000 and 9999999. Following the student number are a number of lines, each containing a student number between 1000000 and 9999999 and a mark between 0 and 100. A line with a student number and mark of 0 terminates each test case. There are no more than 1000 students in the class, and each has a unique student number.

输出

For each test case, output a line giving Johnny's rank in the class.

样例输入 Copy

1234567
1212121 100
1234567 33
2222222 22
9898765 33
0 0
1234567
1212121 100
1234567 22
2222222 33
9898765 33
0 0

样例输出 Copy

2
4