ZCMU-1233-Tour de France
来源:互联网 发布:ubuntu samba 客户端 编辑:程序博客网 时间:2024/05/19 11:47
1233: Tour de France
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 5 Solved: 5
[Submit][Status][Web Board]
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<d2is 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.
For each test case, output the maximum spread rounded to two decimal places.
Input
Please Input Input Here
Output
Please Input Output Here
Sample Input
Sample Output
#include<iostream>#include<cstring>#include<cstdio>#include<cstdlib>#include<algorithm>using namespace std;int main(){ int n,m,i,j,p; double max1; while(~scanf("%d",&n)) { if(n==0) break; scanf("%d",&m); double a[1000]; double b[1000]; double c[1000]; p=0; max1=0; for(i=0;i<n;i++) { scanf("%lf",&a[i]); } for(j=0;j<m;j++) { scanf("%lf",&b[j]); } for(i=0;i<m;i++) { for(j=0;j<n;j++) { c[p++]=b[i]/a[j]; } } sort(c,c+p); for(i=0;i<p-1;i++) { max1=max(max1,c[i+1]/c[i]); } printf("%.2f\n",max1); } return 0;}
- ZCMU-1233-Tour de France
- poj 3300 Tour de France
- Sicily 1450. Tour de France
- Tour de France - 法国大西南
- POJ 3300 Tour de France(简单题)
- POJ 3300 Tour de France 再想想
- POJ 3300 Tour de France(我的水题之路——车轮角速度最大)
- Tour de Flex
- Tour De Babel
- Tour De Babel
- [bzoj3060]Tour de Byteotia
- Developer Connection: Tour de Flex
- BZOJ3060: [Poi2012]Tour de Byteotia
- BZOJ3060 [Poi2012]Tour de Byteotia
- 3060: [Poi2012]Tour de Byteotia
- BZOJ3060: [Poi2012]Tour de Byteotia
- 好东西!Tour de Flex component explorer
- [BZOJ 3060]POI2012 Tour de Byteotia
- VS编程问题-warning C4996: ’strdup’
- 正则表达式
- 用redis写了分布式锁,总感觉缺了点什么
- Selenium定位元素提示Element is not clickable at point 第一篇
- H.264句法和语法总结(九)片层数据句法
- ZCMU-1233-Tour de France
- JAVA中的switch-each语句
- BitmapFactory.Options.inPurgeable
- 说说CSS学习中的瓶颈
- 频繁更新Oracle表更新速度问题解决
- H.264句法和语法总结(十一)宏块层预测句法
- 微信统计数据的获取及存储
- 使用HighChart进行多级钻取
- 涵盖OOP、Java核心、Hibernate、Spring等面试问题