FZU11685 之 跑跑卡丁车
来源:互联网 发布:图标制作软件手机版 编辑:程序博客网 时间:2024/04/27 21:25
Description
Input
Output
一个数代表他到达终点所需要的最少时间,精确到小数点后两位数
Sample Input
2 2
10 20
2 4
3 2
1 5 2
2 3
Sample Output
10.00
3.67
分析:最简单的贪心
AC代码如下:
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=1e3+10;int a[maxn];int b[maxn];bool cmp(int a,int b){ return a>b;}int main(){ int m,n; double sum=0; while(cin>>m>>n) { sum=0; for(int i=0; i<m; i++) cin>>a[i]; for(int i=0; i<n; i++) cin>>b[i]; sort(a,a+m); sort(b,b+n); int i,j; for(i=m-1,j=n-1; i>=0 && j>=0; i--,j--) { sum+=((double)a[i]/b[j]); } while(i>=0) { sum+=a[i]; i--; } printf("%.2lf\n",sum); } return 0;}
0 0
- FZU11685 之 跑跑卡丁车
- 跑跑卡丁车
- 跑跑卡丁车
- 【水题】跑跑卡丁车系列之游戏下载
- 跑跑卡丁车,FT!
- FOJ 1685 跑跑卡丁车
- FZU 1685 跑跑卡丁车
- hdu 1494 跑跑卡丁车
- 数据结构 跑跑卡丁车
- hdu 1494 跑跑卡丁车~
- 跑跑卡丁车 hdu
- hdu 1494 跑跑卡丁车
- Hdu 1494 跑跑卡丁车
- 跑跑卡丁车 HUD
- HDU 1494跑跑卡丁车
- hdu1494 跑跑卡丁车dp
- HDU-1494-跑跑卡丁车
- HDU 1494 跑跑卡丁车
- ajax配合spring实现文件上传
- ubuntu16.04+cuda8.0+cudnn5.1 安装
- 【机器学习】【数据预处理】数据的规范化,归一化,标准化,正则化
- 在网页中嵌入百度地图和使用百度地图api自定义地图
- mammary cancer关联规则挖掘详解
- FZU11685 之 跑跑卡丁车
- [linux]wait详解
- bochs调试
- 2017.5.8 英语口语——小记
- Cordava 基础
- linux上安装maven私有库nexus私服
- Apple Catching POJ
- 消息中间件应用开发
- andoid 6.0权限下调用系统电话call