21165_CowSchoo

2022-5-16 18:18| 发布者: Hocassian| 查看: 37| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504964771500-Problem List-采集的数据-后羿采集器.html

Pro.ID

21165

Title

Cow School

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21165

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Bessy is going to school and doing well. She has taken N (1 ≤ N ≤ 5000 --- except one case where 1 ≤ N ≤ 50,000) tests and recorded the scores (Ti points out of Pi points for testi; 0 ≤ TiPi < 40,000; 0 < Pi) as this task's input.

    Her teacher will drop the D tests with the lowest percentage (Ti/Pi) before calculating Bessie's final grade (which is the sum of the remaining test score points over the sum of the remaining total test points). Bessy is good at math and quickly realizes that this does not benefit her as much as it might.

    To prove her point, Bessy wants to find all values of D for which she could have ended up with a higher grade by choosing to drop different tests than the teacher would have. Help her by finding and printing all values of D for which this is possible.

    Bessy has noted that, amazingly, she has never scored the same percentage on two different tests.

    输入

    * Line 1 : A single integer, N

    * Lines 2 ..N+1 : Line i+1 contains two space-separated integers: Ti and Pi

    输出

    Description

    Bessy is going to school and doing well. She has taken N (1 ≤ N ≤ 5000 --- except one case where 1 ≤ N ≤ 50,000) tests and recorded the scores (Ti points out of Pi points for testi; 0 ≤ TiPi < 40,000; 0 < Pi) as this task's input.

    Her teacher will drop the D tests with the lowest percentage (Ti/Pi) before calculating Bessie's final grade (which is the sum of the remaining test score points over the sum of the remaining total test points). Bessy is good at math and quickly realizes that this does not benefit her as much as it might.

    To prove her point, Bessy wants to find all values of D for which she could have ended up with a higher grade by choosing to drop different tests than the teacher would have. Help her by finding and printing all values of D for which this is possible.

    Bessy has noted that, amazingly, she has never scored the same percentage on two different tests.

    Input

    * Line 1 : A single integer, N

    * Lines 2 ..N+1 : Line i+1 contains two space-separated integers: Ti and Pi

    Output

    * Line 1 : A single integer K ( 0 ≤ KN ) that is the number of values of D for which Bessy could have ended up with a higher grade by dropping a different set of D tests than the teacher.

    * Lines 2 ..K+1 : The values of D for which this is true, in ascending numerical order.

    Sample Input

    5
    1 2
    5 9
    3 8
    4 10
    1 3

    Sample Output

    2
    1
    2

    Hint

    Input Details

    Bessy has taken 5 tests so far and has scores of 1/2, 5/9, 3/8, 4/10, and 1/3.

    Output Details

    For D = 1, dropping 1/3 leads to a final grade of 13/29. A higher final grade of 11/24 can be achieved if Bessy drops 3/8.

    For D = 2, dropping 1/3 and 3/8 lead to a final grade of 10/21. A higher final grade of 7/14 can be achieved if Bessy drops 3/8 and 4/10.

    Source

    样例输入

    5
    1 2
    5 9
    3 8
    4 10
    1 3

    样例输出

    2
    1
    2

    提示

    Input Details

    Bessy has taken 5 tests so far and has scores of 1/2, 5/9, 3/8, 4/10, and 1/3.

    Output Details

    For D = 1, dropping 1/3 leads to a final grade of 13/29. A higher final grade of 11/24 can be achieved if Bessy drops 3/8.

    For D = 2, dropping 1/3 and 3/8 lead to a final grade of 10/21. A higher final grade of 7/14 can be achieved if Bessy drops 3/8 and 4/10.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部