hdu 4442 Physical Examination
来源:互联网 发布:巫师2优化补丁 编辑:程序博客网 时间:2024/06/05 07:50
原题: http://acm.hdu.edu.cn/showproblem.php?pid=4442
//hdu4296//题目大意: WP赶着去参加考试,所以他必须在最短的时间内完成体能测试,WP必须完成完成n个测试项目,而这里n个队列,,他必须在对应的队列完成对应的体能测试//所有队列初始等待时长为0,而每个队列(WP不在的那些队列)每隔一分钟等待时间就会增长bi分钟,每个测试项目所需要花费ai时间 //问WP最少需要多少时间去完成体能测试 //思路: 假设有两个队列,work1: a1,b1;work2: a2,b2; // 方案1:先去work1,再去work2,花费时间time1:a1+a2+a1*b2;方案2:先去work2,再去work1,则time2=a2+a1+a2*b1// 如果方案1时间最短,即time1<time2,则可得a1*b2<a2*b1 我们就可以得到排序方案了 #include<iostream>#include<algorithm>#include<cstdio>#define qwq 0x7fffffffusing namespace std;typedef long long ll;const ll Mod=365*24*60*60; struct W{ll time;ll wait;}w[100001];int cmp(W a,W b)//排序方案 {return a.time*b.wait<a.wait*b.time; }int main(){int n;scanf("%d",&n);while(n!=0){for(int i=0;i<n;i++){scanf("%lld %lld",&w[i].time,&w[i].wait);}sort(w,w+n,cmp);ll sum=0;for(int i=0;i<n;i++){sum=(sum+w[i].time+sum*w[i].wait)%Mod;}printf("%lld\n",sum);scanf("%d",&n);}return 0;}
阅读全文
0 0
- hdu 4442 Physical Examination
- HDU 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu - 4442 - Physical Examination
- HDU 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu 4442 Physical Examination
- HDU 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu 4442 Physical Examination
- hdu 4442 Physical Examination (排序)
- 贪心--HDU - 4442 Physical Examination
- HDU 4442 Physical Examination (贪心)
- HDU-#4442 Physical Examination(贪心)
- hdu 4442 Physical Examination(贪心)
- hdu 4442 Physical Examination(水题)
- 替换QQ音乐背景音
- 问题 S: 说反话
- vb.net 教程 12-4 msHtml 5 偷梁换柱
- [3]React 深入浅出-----JSX简介
- Java密码学
- hdu 4442 Physical Examination
- 线程——消费者生产者
- UDP服务器、客户端的简单实现
- 合并txt文件
- 问题 T: A+B和C比大小
- const关键字
- perl 生成json树
- Angular 基础部分 1.1 简介
- Android View — Gradient 渐变