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——坑爹的更多相关文章

  1. Elasticsearch 的坑爹事——记录一次mapping field修改过程

    Elasticsearch 的坑爹事 本文记录一次Elasticsearch mapping field修改过程 团队使用Elasticsearch做日志的分类检索分析服务,使用了类似如下的_mapp ...

  2. [iOS]坑爹的ALAsset(Assets Library Framework)

    Assets Library Framework 可以用来做iOS上的多选器,选照片视频啥的啦就不介绍了. 目前的项目有点类似dropbox,可以选择设备内的照片然后帮你上传文件,使用了Assets ...

  3. .net core 一次坑爹的类库打包过程

    众所周知,.net core 跨平台类库引用一定要通过nuget获得.(如有问题,欢迎指出) 打包 将普通.net project转换成.net core 的类库有两种方式: 1.新建.net cor ...

  4. 首师大附中互测题:50136142WXY的坑爹百度地图【B006】(可以喝的超大桶水)

    [B006]50136142WXY的坑爹百度地图[难度B]——————————————————————————————————————————————————————————————————————— ...

  5. 坑爹坑娘坑祖宗的87端口(记一次tomcat故障排查)

    原贴如下 坑爹坑娘坑祖宗的87端口(记一次tomcat故障排查) 虽然我用的是PHPstudy部署的dedecms,还是一样栽倒这个坑里了. 总结经验:本地测试使用8000~9000的端口比较安全.

  6. 坑爹的 SONY AS100V GPS

    事情是这样的,为了记录自己的生活,也是出于对视频编辑的兴趣,买了一台 SONY 的 AS100V 运动摄像机. 公司到货,回家路上拍了一段,回家兴冲冲的连上电脑,想看看 GPS 数据,发现是 SONY ...

  7. app里使用163邮箱发送邮件,被163认为是垃圾邮件的坑爹经历!_ !

    最近有个项目,要发邮件给用户设定的邮箱报警,然后就用了163邮箱,代码是网上借来的^^,如下: package com.smartdoorbell.util; import android.os.As ...

  8. ASP.NET之Cookie(坑爹的Response.Cookies.Remove)(转)

      在web开发中Cookie是必不可少的 .NET自然也有一个强大的Cookie操作类,我们用起来也非常方便,不过在使用中我们会发现一个坑爹的事情Response.Cookies.Remove删除不 ...

  9. Lua: 好的, 坏的, 和坑爹的

                                   好的       小巧: 20000行C代码 可以编译进182K的可执行文件 (Linux下).       可移植: 只要是有ANSI ...

随机推荐

  1. MFC自绘控件学习总结第二贴

    首先感谢大家对第一帖的支持,应一些网友烈要求下面我在关于上一贴的一些补充和说明(老鸟可以无视)这一贴是实战+理论不知道第一帖的先看第一帖:http://topic.csdn.net/u/2011071 ...

  2. SDUT Fermat’s Chirstmas Theorem(素数筛)

    Fermat's Chirstmas Theorem Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 In a letter ...

  3. freemarker的TemplateExceptionHandler使用

    系统使用freemarker作为页面展示层,为了解决系统统一异常的问题.于是配置了struts2的统一异常解决的方法(这个网上资料非常多,大家能够查看),但是发现freemarker出现异常后,str ...

  4. flask开发restful api

    flask开发restful api 如果有几个原因可以让你爱上flask这个极其灵活的库,我想蓝图绝对应该算上一个,部署蓝图以后,你会发现整个程序结构非常清晰,模块之间相互不影响.蓝图对restfu ...

  5. 用VC实现竖写汉字的方法

    中国人自古就有自右至左.从上到下书写汉字的习惯.而当我们在自己所编写的应用程序中使用输出函数输出的总是自左至右的横排文字.有没有可能在我们的应用程序中实现竖写汉字的效果呢?笔者偶然发现了一种利用VC实 ...

  6. memcached vs MySQL Memory engine table 速度比较_XMPP Jabber即时通讯开发实践_百度空间

    memcached vs MySQL Memory engine table 速度比较_XMPP Jabber即时通讯开发实践_百度空间 memcached vs MySQL Memory engin ...

  7. UVA 11054 Wine trading in Gergovia 葡萄酒交易 贪心+模拟

    题意:一题街道上很多酒店,交易葡萄酒,正数为卖出葡萄酒,负数为需要葡萄酒,总需求量和总售出量是相等的,从一家店到另外一家店需要路费(路费=距离×运算量),假设每家店线性排列且相邻两店之间距离都是1,求 ...

  8. ACE的构建(VC++6.0环境)

    ACE的构建(VC++6.0环境)Windows下ACE的构建1. 将ACE-5.5.zip解压到所需的安装目录,此处以E:/为例,解压后形成ACE_wrappers文件夹,因此ACE将会存在于ACE ...

  9. ThinkPhp学习03

    原文:ThinkPhp学习03 一.ThinkPHP 3 的输出      (重点) a.通过 echo 等PHP原生的输出方式在页面中输出 b.通过display方法输出   想分配变量可以使用as ...

  10. KMP(Knuth-Morris-Pratt)算法

    一.朴素匹配算法 也就是暴力匹配算法.设匹配字符串的长度为n,模式串的长度为m,在最坏情况下,朴字符串匹配算法执行时间为O((n - m + 1)m). 假设m = n / 2, 那么该算法的复杂度就 ...