2014 (多校)1011 ZCC Loves Codefires
自从做了多校,整个人都不好了,老是被高中生就算了,题老是都不懂=-=原谅我是个菜鸟,原谅我智力不行。唯一的水题。
Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called "Memset137".
It was on Codefires(CF), an online competitive programming site, that ZCC knew Memset137, and immediately became his fan.
But why?
Because Memset137 can solve all problem in rounds, without unsuccessful submissions; his estimation of time to solve certain problem is so accurate, that he can surely get an Accepted the second he has predicted. He soon became IGM, the best title of Codefires. Besides, he is famous for his coding speed and the achievement in the field of Data Structures.
After become IGM, Memset137 has a new goal: He wants his score in CF rounds to be as large as possible.
What is score? In Codefires, every problem has 2 attributes, let's call them Ki and Bi(Ki, Bi>0). if Memset137 solves the problem at Ti-th second, he gained Bi-Ki*Ti score. It's guaranteed Bi-Ki*Ti is always positive during the round time.
Now that Memset137 can solve every problem, in this problem, Bi is of no concern. Please write a program to calculate the minimal score he will lose.(that is, the sum of Ki*Ti).
The first line contains an integer N(1≤N≤10^5), the number of problem in the round.
The second line contains N integers Ei(1≤Ei≤10^4), the time(second) to solve the i-th problem.
The last line contains N integers Ki(1≤Ki≤10^4), as was described.
One integer L, the minimal score he will lose.
3
10 10 20
1 2 3
150HintMemset137 takes the first 10 seconds to solve problem B, then solves problem C at the end of the 30th second. Memset137 gets AK at the end of the 40th second.
L = 10 * 2 + (10+20) * 3 + (10+20+10) * 1 = 150.
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
struct node{
int x,y;
}a[maxn];
int cmp(node l1,node l2)
{
return l1.x*l2.y<l2.x*l1.y;
}
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
scanf("%d",&a[i].x);
for(int i=0;i<n;i++)
scanf("%d",&a[i].y);
sort(a,a+n,cmp);
long long sum=0,s=0;
for(int i=0;i<n;i++)
{
sum+=a[i].x;
s+=sum*a[i].y;
}
printf("%I64d\n",s);
}
return 0;
}
2014 (多校)1011 ZCC Loves Codefires的更多相关文章
- 2014---多校训练2(ZCC Loves Codefires)
ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- HDU 4882 ZCC Loves Codefires(贪心)
ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- hdu 4882 ZCC Loves Codefires(数学题+贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4882 ------------------------------------------------ ...
- HDU-4882 ZCC Loves Codefires
http://acm.hdu.edu.cn/showproblem.php?pid=4882 ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Ot ...
- HDU 4882 ZCC Loves Codefires (贪心)
ZCC Loves Codefires 题目链接: http://acm.hust.edu.cn/vjudge/contest/121349#problem/B Description Though ...
- 2014多校第二场1011 || HDU 4882 ZCC Loves Codefires (贪心)
题目链接 题意 : 给出n个问题,每个问题有两个参数,一个ei(所要耗费的时间),一个ki(能得到的score).每道问题需要耗费:(当前耗费的时间)*ki,问怎样组合问题的处理顺序可以使得耗费达到最 ...
- BZOJ 3850: ZCC Loves Codefires【贪心】
Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called "Memset137". It wa ...
- 【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)
http://www.lydsy.com/JudgeOnline/problem.php?id=3850 题意:类似国王游戏....无意义.. #include <cstdio> #inc ...
- 【BZOJ】【3850】ZCC Loves Codefires
贪心 就跟NOIP2012国王游戏差不多,考虑交换相邻两题的位置,对其他题是毫无影响的,然后看两题顺序先后哪个更优.sort即可. WA了一次的原因:虽然ans开的是long long,但是在这一句: ...
随机推荐
- intel线程库tbb的使用
[size=small]首先下载: http://www.threadingbuildingblocks.org/uploads/77/111/2.1/tbb21_20080605oss_win.zi ...
- Geodatabase - 打开要素类
string dbPath = @"G:\doc\gis\1.400\data\pdb.mdb"; ESRI.ArcGIS.Geodatabase.IWorkspaceFactor ...
- 诡异的SpriteKit 游戏查错
在Endless Runner 游戏中,做了一些atlas后,发现有个问题,当player跳跃起来的时候,发现他没有动画了,被默认的X图片代替.原来的图像是这样的. 在增加了一些动画后,我的效果就成这 ...
- linux install zh_CN(ubuntu)
cd /usr/share/locales sudo ./install-language-pack zh_CN
- cocos2dx 字体描边方法介绍
转载地址:http://www.taikr.com/group/2/thread/1606 关于cocos2dx 字体描边的实现,不考虑效果和效率的话,是有三种方式: ① 利用CCLabelTTF制作 ...
- hdu5348 MZL's endless loop(欧拉回路)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud MZL's endless loop Time Limit: 3000/1500 ...
- 在mac中导入hadoop2.6.0源代码至eclipse
一.环境准备 1.安装jdk.maven等 2.下载hadoop源代码,并解压 3.将tools.jar复制到Classes中,具体原因见http://wiki.apache.org/hadoop/H ...
- hadoop中datanode无法启动
一.问题描述 当我多次格式化文件系统时,如 [hadoop@xsh hadoop]$ ./bin/hdfs namenode -format 会出现datanode无法启动,查看日志(/usr/loc ...
- 使用Japserreport填充报表数据(3)
E中以PDF文件的格式显示静态的中文字符串,在大多数的情况下,打印的数据来自于一些变量,在JasperReports工具中传递数据并填充到 报表只有两种方式,即使用Parameters参数和JRDat ...
- 数据结构与算法javascript描述
<数据结构与算法javascript描述>--数组篇 导读: 这篇文章比较长,介绍了数组常见的操作方法以及一些注意事项,最后还有几道经典的练习题(面试题). 数组的定义: JavaScri ...