22798_TourdeFrance

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

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

Pro.ID

22798

Title

Tour de France

Title链接

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

AC

26

Submit

36

Ratio

72.22%

时间&空间限制

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

    A racing bicycle is driven by a chain connecting two sprockets. Sprockets are grouped into two clusters: the front cluster (typically consisting of 2 or 3 sprockets) and the rear cluster (typically consisting of between 5 and 10 sprockets). At any time the chain connects one of the front sprockets to one of the rear sprockets. The drive ratio -- the ratio of the angular velocity of the pedals to that of the wheels -- is n:m where n is the number of teeth on the rear sprocket and m is the number of teeth on the front sprocket. Two drive ratios d1 < d2 are adjacent if there is no other drive ratio d1 < d3 < d2. The spread between a pair of drive ratios d1 < d2 is their quotient: d2/d1. You are to compute the maximum spread between two adjacent drive ratios achieved by a particular pair of front and rear clusters.

    输入

    Input consists of several test cases, followed by a line containing 0. Each test case is specified by the following input:

    • f : the number of sprockets in the front cluster;

    • r : the number of sprockets in the rear cluster;

    • f  integers, each giving the number of teeth on one of the gears in the front cluster;

    • r  integers, each giving the number of teeth on one of the gears in the rear cluster.

    You may assume that no cluster has more than 10 sprockets and that no gear has fewer than 10 or more than 100 teeth.

    输出

    Description

    A racing bicycle is driven by a chain connecting two sprockets. Sprockets are grouped into two clusters: the front cluster (typically consisting of 2 or 3 sprockets) and the rear cluster (typically consisting of between 5 and 10 sprockets). At any time the chain connects one of the front sprockets to one of the rear sprockets. The drive ratio -- the ratio of the angular velocity of the pedals to that of the wheels -- is n:m where n is the number of teeth on the rear sprocket and m is the number of teeth on the front sprocket. Two drive ratios d1 < d2 are adjacent if there is no other drive ratio d1 < d3 < d2. The spread between a pair of drive ratios d1 < d2 is their quotient: d2/d1. You are to compute the maximum spread between two adjacent drive ratios achieved by a particular pair of front and rear clusters.

    Input

    Input consists of several test cases, followed by a line containing 0. Each test case is specified by the following input:

    • f : the number of sprockets in the front cluster;

    • r : the number of sprockets in the rear cluster;

    • f  integers, each giving the number of teeth on one of the gears in the front cluster;

    • r  integers, each giving the number of teeth on one of the gears in the rear cluster.

    You may assume that no cluster has more than 10 sprockets and that no gear has fewer than 10 or more than 100 teeth.

    Output

    For each test case, output one line : the maximum spread rounded to two decimal places.

    Sample Input

    2 4
    40 50
    12 14 16 19
    0

    Sample Output

    1.19

    Source

    样例输入

    2 4
    40 50
    12 14 16 19
    0

    样例输出

    1.19

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部