poj 3262 Protecting the Flowers(贪心)
来源:互联网 发布:java 视频监控系统 编辑:程序博客网 时间:2024/05/17 09:09
题意:
有n个牛在FJ的花园乱吃。
所以FJ要赶他们回牛棚。
每个牛在被赶走之前每秒吃Di个花朵。赶它回去FJ要花的时间是Ti。在被赶走的过程中牛就不能乱吃了。
注意大数陷阱
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct In{int x,y;}; In cows[100010];int cmp(In a,In b){return a.y*1.0/a.x>b.y*1.0/b.x;}int main(){int n,m,i,j;long long s,t;while(~scanf("%d",&n)){memset(cows,0,sizeof(cows));for(i=0;i<n;i++){scanf("%d%d",&cows[i].x,&cows[i].y);}sort(cows,cows+n,cmp);//s=cows[0].y,t=cows[0].x*2;for(s=t=i=0;i<n;i++){s+=t*cows[i].y;t+=cows[i].x*2;}printf("%lld\n",s);}return 0;}
0 0
- POJ 3262 Protecting the Flowers 贪心
- poj 3262 Protecting the Flowers (贪心)
- poj 3262 Protecting the Flowers(贪心)
- poj 3262 Protecting the Flowers 【贪心】
- poj 3262 Protecting the Flowers(贪心)
- Protecting the Flowers - POJ 3262 贪心
- poj 3262 Protecting the Flowers(贪心)
- POJ 3262 Protecting the Flowers【贪心】
- POJ 3262 - Protecting the Flowers(贪心)
- POJ 3262 Protecting the Flowers (贪心)
- POJ 3262 Protecting the Flowers(贪心)
- POJ 3262 Protecting the Flowers(贪心)
- Poj 3262 Protecting the Flowers【贪心】
- POJ 3262 Protecting the Flowers 贪心
- 【贪心】POJ 3262 Protecting the Flowers
- *Protecting the Flowers(POJ 3262, 贪心)
- POJ 3262 Protecting the Flowers(贪心,需要小小优化一下)
- POJ 3262-Protecting the Flowers(贪心+前缀和)
- windows程序设计绘图模式及映射模式
- 身份证复印件扫描件必须签字或加水印防止被盗用
- 黑马程序员-----静态static同步锁(黑马视频)
- Android获取手机内存状态
- 重启eclipse后,所有的Android项目目录都没了
- poj 3262 Protecting the Flowers(贪心)
- 关于EAS自动退出的问题的处理办法
- NiftyDialogEffects
- 树-堆结构练习——合并果子之哈夫曼树
- C语言中字符数组和字符串指针分析
- expect脚本参数传递,自动登陆远程主机
- 黑马程序员-----同步函数锁,this锁(黑马视频)
- iOS实现树类
- scanf和gets的区别