The mell hall——坑爹
The mell hall
题目描述
In HUST,there are always manystudents go to the mell hall at the same time as soon as the bell rings.
Students have to queue up for a meal,and the queue is awalys long,So it takes much time.Suposse there
are N people in a queue,each personhas two characteristic value A and B(both of them are integers,read
input for more details),the i-thperson in the queue have to spend m(i) =
A1A2
:::Ai 1
Bi
minutes,Where
Ai
,Bi
is the i-th person.s valueA,B.Notice that if the order of the queue changes,the waiting time one
spend(that is,the value of m(i))maychanges too. Of course,every student want to reduce the time he
spend.
Apparently,it is impossible to makeeveryone satis
ed,in this problem,we only need to minimize the
waiting time of one who spend thelongest time in the queue,that is,minimize Max m(1),m(2),,,m(n).You
can change the order of the queue inanyway in order to complete this problem.
You are asked to output the originallocation in the queue of the person who will cost the longest time
under optimal solution. Uniquity isinsured by the given data.
输入
There are multiple test cases.
For each case, the
rst line contains one integerN(1N1000).
The second line containsNintegers Ai
.(0 < Ai <100000)
The third line containsNintergers Bi
(0< Bi <10).
(Bi <10< Ai*bi)
输出
You are asked to output the originallocation in the queue of the person who will cost the longest time
under optimal solution. Uniquity isinsured by the given data.
样例输入
3
15 20 25
1 3 2
样例输出
2
意思没看懂,听人解释后很简单。就是找出a[i]*b[i]的最大值的i值就行了!
#include<iostream>
using namespace std;
int main()
{
int n,i;
int a[100005],b[100005];
int m,t;
while(cin>>n)
{
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
cin>>b[i];
m=a[0]*b[0];
t=0;
for(i=1;i<n;i++)
{
if(a[i]*b[i]>m)
{
m=a[i]*b[i];
t=i;
}
}
cout<<t+1<<endl;
}
return 0;
}
The mell hall——坑爹的更多相关文章
- Elasticsearch 的坑爹事——记录一次mapping field修改过程
Elasticsearch 的坑爹事 本文记录一次Elasticsearch mapping field修改过程 团队使用Elasticsearch做日志的分类检索分析服务,使用了类似如下的_mapp ...
- [iOS]坑爹的ALAsset(Assets Library Framework)
Assets Library Framework 可以用来做iOS上的多选器,选照片视频啥的啦就不介绍了. 目前的项目有点类似dropbox,可以选择设备内的照片然后帮你上传文件,使用了Assets ...
- .net core 一次坑爹的类库打包过程
众所周知,.net core 跨平台类库引用一定要通过nuget获得.(如有问题,欢迎指出) 打包 将普通.net project转换成.net core 的类库有两种方式: 1.新建.net cor ...
- 首师大附中互测题:50136142WXY的坑爹百度地图【B006】(可以喝的超大桶水)
[B006]50136142WXY的坑爹百度地图[难度B]——————————————————————————————————————————————————————————————————————— ...
- 坑爹坑娘坑祖宗的87端口(记一次tomcat故障排查)
原贴如下 坑爹坑娘坑祖宗的87端口(记一次tomcat故障排查) 虽然我用的是PHPstudy部署的dedecms,还是一样栽倒这个坑里了. 总结经验:本地测试使用8000~9000的端口比较安全.
- 坑爹的 SONY AS100V GPS
事情是这样的,为了记录自己的生活,也是出于对视频编辑的兴趣,买了一台 SONY 的 AS100V 运动摄像机. 公司到货,回家路上拍了一段,回家兴冲冲的连上电脑,想看看 GPS 数据,发现是 SONY ...
- app里使用163邮箱发送邮件,被163认为是垃圾邮件的坑爹经历!_ !
最近有个项目,要发邮件给用户设定的邮箱报警,然后就用了163邮箱,代码是网上借来的^^,如下: package com.smartdoorbell.util; import android.os.As ...
- ASP.NET之Cookie(坑爹的Response.Cookies.Remove)(转)
在web开发中Cookie是必不可少的 .NET自然也有一个强大的Cookie操作类,我们用起来也非常方便,不过在使用中我们会发现一个坑爹的事情Response.Cookies.Remove删除不 ...
- Lua: 好的, 坏的, 和坑爹的
好的 小巧: 20000行C代码 可以编译进182K的可执行文件 (Linux下). 可移植: 只要是有ANSI ...
随机推荐
- 网页插入QQ 无需加好友
<p>联系方式:1073351325<a href="tencent://message/?Menu=yes&uin=1073351325&Site=dsf ...
- Python 生成的页面中文乱码问题
第一 保证 程序源文件里的中文的编码格式,如我们把 源文件的编码设置成utf8的. reload(sys) sys.setdefaultencoding('utf-8') 第二, 告诉浏览器,我们须要 ...
- Html网页表格结构化标记的应用
在讲网页表格的结构化标记之前,还是先看几幅图片. Html表格的结构化 所谓的结构化,正如上述第一副图所看到的,就是把我们的表格划分为三种:表头.表体.表尾.从而当我们在改动表体部分的时候,不会影响到 ...
- squid+apache实现缓存加速
本实例是squid和apache在同一台机器上,squid做前端反向代理.port为80,apache作为后端web,port为81 serverip:172.16.8.102 1.首先介绍下版本号选 ...
- Guava学习笔记:EventBus(转)
EventBus是Guava的事件处理机制,是设计模式中的观察者模式(生产/消费者编程模型)的优雅实现.对于事件监听和发布订阅模式,EventBus是一个非常优雅和简单解决方案,我们不用创建复杂的类和 ...
- css js 优化工具
我知道国内很多网页制作人员都还在制作table式网页,这样的网页打开速度很慢.如果要想网站打开速度快,就要学会使用DIV+CSS,将图片写进CSS,这样如果网站内容很多的时候,也不会影响网页的浏览.它 ...
- mysql update 有无索引对比
<pre name="code" class="html">mysql> desc ProductInfo; +--------------- ...
- 14.3.2.4 Locking Reads 锁定读
14.3.2.4 Locking Reads 锁定读 如果你的查询数据,然后插入或者更新相关的数据 在同一个事务, 普通的SELECT 语句不足以给予足够保护. 其他事务可以更新或者删除相同的你要查询 ...
- 【C++版】Face Alignment at 3000 FPS by Regressing Local Binary Features源码下载
下载地址: 本帖隐藏的内容 <ignore_js_op> face-alignment-in-3000fps-master.zip (794.42 KB, 下载次数: 1076) 该源码采 ...
- 小心LinkedHashMap的get()方法(转)
这是一个来自实际项目的例子,在这个案例中,有同事基于jdk中的LinkedHashMap设计了一个LRUCache,为了提高性能,使用了 ReentrantReadWriteLock 读写锁:写锁对应 ...