编程介的小学生 2019-06-06 17:53 采纳率: 20.5%
浏览 121

输出可能的领先的选手数量的算法,怎么使用C语言的程序编写的过程的方式去实现的程序编写

Problem Description
Since members of Wuhan University ACM Team are lack of exercise, they plan to participate in a ten-thousand-people Marathon. It is common that the athletes run very fast at first but slow down later on. Start from this moment, we can assume that everyone is moving forward in a constant speed. ACMers love algorithms, so they want to know not only the result but also who may be in the leading position. Now we know all athletes' position and speed at a specific moment. The problem is, starting from this moment, how many athletes may be the leader. Please notice that there's no leader if two or more athletes are at the leading position at the same time. No two athletes may have the same speed.

Input
The input consists of several test cases. The first line of input consists of an integer T, indicating the number of test cases. The first line of each test case consists of an integer N, indicating the number of athletes. Each of the following N lines consists of two integers: p, v, indicating an athlete's position and speed.

Technical Specification

  1. T ≤ 20
  2. 0 < N ≤ 50000
  3. 0 < p, v ≤ 2000,000,000
  4. An athlete's position is the distant between him/her and the start line.
  5. The Marathon is so long that you can assume there's no finishline.

Output
For each test case, output the number of possible leaders on a separate line.

Sample Input
1
3
1 1
2 3
3 2

Sample Output
2

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
    • ¥15 C#调用python代码(python带有库)
    • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
    • ¥15 活动选择题。最多可以参加几个项目?
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题
    • ¥20 云服务Linux系统TCP-MSS值修改?
    • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
    • ¥20 怎么在stm32门禁成品上增加查询记录功能
    • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面