2014---多校训练2(ZCC Loves Codefires)
ZCC Loves Codefires
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 790 Accepted Submission(s): 420
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 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.
10 10 20
1 2 3
Memset137 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<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
struct node{
int e,t;
bool operator < (const node a) const{
return e*a.t>a.e*t;
}
}map[];
int main(){
int n,i;
__int64 tat,ans;
while(scanf("%d",&n)!=EOF){
for(i=;i<n;i++)
scanf("%d",&map[i].t);
for(i=;i<n;i++)
scanf("%d",&map[i].e);
sort(map,map+n);
for(ans=tat=i=;i<n;i++){
tat+=map[i].t;
ans+=tat*map[i].e;
}
printf("%I64d\n",ans);
}
return ;
}
2014---多校训练2(ZCC Loves Codefires)的更多相关文章
- 2014 (多校)1011 ZCC Loves Codefires
自从做了多校,整个人都不好了,老是被高中生就算了,题老是都不懂=-=原谅我是个菜鸟,原谅我智力不行.唯一的水题. Problem Description Though ZCC has many Fan ...
- 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,但是在这一句: ...
随机推荐
- ARM家族大检阅
首先列举下几个名称: 6410 2440 210 A8 ARM9 ARM11 ARMv7 ARMv6 进行分类: 1.芯片名称: 2440 6410 210 2.ARM核: A8 ARM9 ARM11 ...
- Shared Assembilies and Strongly Named Assemblies
the .NET Framework has in place to deal with versioning problems. Two Kinds of Assemblies, Two Kinds ...
- CUBRID学习笔记 40 使用net修改数据
修改 connection.Open(); string queryString = "UPDATE nation set capital = 'X' where `code` = ...
- Typescript的面向对象
封装: var Greeter = (function () { function Greeter(message) { this.greeting = message; } Greeter.prot ...
- 关于JavaScript测试工具:QUnit, Jasmine, MoCha
在进行前端开发过程中,在某些场景下,需要通过编写单元测试来提高代码质量.而JavaScript常用的单元测试框架有这几个:QUnit, Jasmine, MoCha.下面就基于这三个工具,简单做一比较 ...
- canvas背景透明
var can=document.getElementById("canv"); c=can.getContext("2d"); c.globalAlpha=. ...
- ZOJ-2364 Data Transmission 分层图阻塞流 Dinic+贪心预流
题意:给定一个分层图,即只能够在相邻层次之间流动,给定了各个顶点的层次.要求输出一个阻塞流. 分析:该题直接Dinic求最大流TLE了,网上说采用Isap也TLE,而最大流中的最高标号预流推进(HLP ...
- iOS - OC 基本语法
1.常见文件扩展名 .c C 语言源文件 .cc..cpp C++ 语言源文件 .m Objective-C 源文件 .mm Objective-C++ 源文件 .h 头文件 .pl Perl 源文件 ...
- mysql概要(三)having
1.运算符 2.模糊查询 3.where 后的判断基于表(表的直接内容),而不是基于结果(运算之后的别名)如: 可改成在where后再次重新计算判断: 或者使用having对结果判断: having多 ...
- Linux_常用命令_04_挂载
1. mount [-t vfstype] [-o options] device dir ZC: -o 后面跟多个option的话,用逗号隔开.(例如:"mount -o rw,remou ...