Problem Description

Jackson wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute Jackson’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.

Input

The input consist of several test cases. Each case begins with the student number of Jackson, an integer between 10000000 and 99999999. Following the student number are several lines, each containing a student number between 10000000 and 99999999 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.

Output

For each test case, output a line giving Jackson’s rank in the class.

Sample Input

20070101

20070102 100

20070101 33

20070103 22

20070106 33

0 0

Sample Output

2

其实就是统计按成绩排名,第一个输入的是学号,这个学号对应的成绩可以排第几!!!

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
while(sc.hasNext()){
long[] a = new long[1005];
long[] b = new long[1005];
long n = sc.nextLong();
int k=0;
int num=0;
for(int i=0;;i++){
a[i]=sc.nextLong();
b[i]=sc.nextLong();
if(a[i]==0){
num=i;
break;
}
if(a[i]==n){
k=i;
}
}
int tm=1;
for(int i=0;i<num;i++){
//System.out.println(a[i]);
if(b[i]>b[k]){
tm++;
}
} System.out.println(tm); } } }

HDOJ(HDU) 1718 Rank(水题、、、)的更多相关文章

  1. hdu 1718 Rank

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1718 Rank Description Jackson wants to know his rank ...

  2. hdu 5210 delete 水题

    Delete Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 D ...

  3. HDOJ/HDU 2568 前进(简单题)

    Problem Description 轻松通过墓碑,进入古墓后,才发现里面别有洞天. 突然,Yifenfei发现自己周围是黑压压的一群蝙蝠,个个扇动翅膀正准备一起向他发起进攻! 形势十分危急! 好在 ...

  4. hdu 1251 (Trie水题)

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submi ...

  5. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  6. HDU 4493 Tutor 水题的收获。。

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...

  7. hdu 4802 GPA 水题

    GPA Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Des ...

  8. hdu 4493 Tutor 水题

    Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 D ...

  9. HDU 1718 Rank counting sort解法

    本题是利用counting sort的思想去解题. 注意本题,好像利用直接排序,然后查找rank是会直接被判WA的.奇怪的推断系统. 由于分数值的范围是0到100,很小,而student 号码又很大, ...

随机推荐

  1. debian7 安装配置

    最近几天折腾了一下Debian 7 (gnome桌面DVD版,KDE桌面CD版最后会提到),总的来说收获还是挺大的,对比以前使用ubuntu,debian 7给我的感觉像是一个新生婴儿,不带多余的花俏 ...

  2. JS可控制的图片自动循环播放查看效果

    JS可控制的图片自动循环播放查看效果 <html> <head> <title>JS可控制的图片自动循环播放查看效果丨芯晴网页特效丨CsrCode.Cn</t ...

  3. Cookie的读写

    记住怎么写就可以了,不要问我为什么=_= 设置值的页面:context.Response.SetCookie(new HttpCookie("username",username) ...

  4. 遍历aspx页面中所有的指定控件

    //1.遍历页面中所有的TextBox,并将值设置成String.Empty for (int j = 0; j < this.Controls.Count; j++){      foreac ...

  5. Linux命令行下svn ignore忽略文件或文件夹用法

    一.忽略单个目录 1.忽略文件夹 假如目录oa.youxi.com是从svn checkout出来的,在服务器本地目录添加了material,但是不希望把material加入版本控制,因此我们需要忽略 ...

  6. plsql 把数据导出成为 .sql文件,记住了

    今天上午,同事 提醒我.可以直接把数据导出成 .sql 文件,类似于 反编译.见下图

  7. 合理计划 dictionary cache 大小

    [数据字典缓冲区(Data Dictionary Cache)  ] 用于存放Oracle系统管理自身所需要的所有信息,包括登录的用户名.用户对象.权限等. 查看 data dictionary ca ...

  8. 【转】 Xcode基本操作

    原文: http://blog.csdn.net/phunxm/article/details/17044337 1.IDE概览 Gutter & Ribbon 焦点列:灰色深度与代码嵌套深度 ...

  9. linux 命令及进程控制

    main.c  main.o/main.obj  main/main.exe          编译                连接 程序运行;      两步: gcc/g++  -c  mai ...

  10. underscorejs-some学习

    2.11 some 2.11.1 语法: _.some(list, predicate, [context]) 2.11.2 说明: 对list集合的每个成员根据predicate进行真值检测,如果一 ...