问题2230--Ride My Bicycle

2230: Ride My Bicycle

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

题目描述

Alan Chester Mason, worried about the overuse of fossil fuels and his own expanding waist, has decided to purchase a bicycle. The model he has decided on has 3 chain rings on the crank (the gears attached to the pedal mechanism) and 7 gears on the back wheel. There is a chain connecting one front chain ring to one back gear. This selection can be changed (via the derailleurs) to any combination of front chain ring and back gear desired. The ease of pedalling is determined by the ratio of teeth in the chosen chain ring and the chosen back ring. The smaller the ratio, the easier it is to pedal. Alan has many options for the number of teeth in each chain ring and each back gear and wishes to see what the gearing (that is, ratios) would be for various combinations. You are to write a program to help him out.

输入

Input for this program will be the description of one con guration of chain rings and back gears. Input will be speci ed on two lines. The rst line will have three positive integers, separated by single spaces, in strictly increasing order giving the number of teeth on each chain ring. The second line will contain 7 positive integers, separated by spaces, in strictly increasing order giving the number of teeth on each back gear. We will refer to the chain rings as chain rings 1, 2 and 3 from smallest to largest. We refer to the back gears in a similar manner.

输出

You should generate 21 lines of output for this program. Each line should give information about one particular combination of chain ring and back ring and should be of the form x.xx f b where f is the number of the chain ring, b is the number of the back ring and x.xx is the ratio of (teeth in f)/(teeth in b) given to 2 decimal places. These numbers are separated by a single space. These lines are to be printed from smallest ratio to largest. If two (or more) ratios are equal, print the one with the smallest chain ring rst. You may assume that the number of teeth are such that the ratios will all be less than 10.

样例输入 Copy

32 42 52
12 15 17 18 21 24 28

样例输出 Copy

1.14 1 7
1.33 1 6
1.50 2 7
1.52 1 5
1.75 2 6
1.78 1 4
1.86 3 7
1.88 1 3
2.00 2 5
2.13 1 2
2.17 3 6
2.33 2 4
2.47 2 3
2.48 3 5
2.67 1 1
2.80 2 2
2.89 3 4
3.06 3 3
3.47 3 2
3.50 2 1
4.33 3 1

来源/分类