POJ 2393-Yogurt factory 贪心算法
来源:互联网 发布:文明5手机版java 编辑:程序博客网 时间:2024/05/08 16:41
题意:每周都会生产牛奶,会有生产的单价和上交的数量,如果不这个月生产,可以在前几个月生产,那样就会产生存储的费用,然后就让你求最低的生产成本。
只要这个月生产的成本低于前面月份生产成本和存储的费用就这个月生产。
#include<stdio.h>struct p{ int x,y;}num[10010];int main(){ int n,m;; scanf("%d%d",&n,&m); for(int i=0;i<n;i++) scanf("%d%d",&num[i].x,&num[i].y); long long sum=0; sum=num[0].x*num[0].y; for(int i=1;i<n;i++) { int t=i; for(int j=0;j<i;j++) { if(num[i].x-num[j].x>=(i-j)*m) t=j; } sum+=((i-t)*m+num[t].x)*num[i].y; } printf("%lld\n",sum); return 0;}
0 0
- POJ 2393-Yogurt factory 贪心算法
- POJ 2393 Yogurt factory(贪心)
- Poj 2393 Yogurt factory【贪心】
- POJ 2393 Yogurt factory 贪心
- POJ 2393 Yogurt factory(贪心)
- 【POJ】2393-Yogurt factory 贪心
- poj 2393 —— Yogurt factory (贪心)
- POJ 2393 Yogurt factory(贪心)
- POJ 2393 Yogurt factory(简单贪心)
- POJ 2393 - Yogurt factory(贪心)
- POJ 2393 Yogurt factory(贪心)
- POJ 2393 Yogurt factory(贪心 or DP)
- POJ 2393 Yogurt factory 【贪心 水】
- POJ 2393 Yogurt factory(贪心)
- POJ 2393-Yogurt factory(贪心)
- POJ 2393 Yogurt factory (贪心)
- POJ 2393 Yogurt factory (贪心)
- POJ 2393 Yogurt Factory(贪心 ?? dp)
- 安卓开发工具优化APK,让软件更流畅
- stm32 IO 分类
- PLSQL Developer建表时注释(COMMENT)中文乱码的解决方案(Windows)
- 触摸屏中禁用右键的方法
- 常用的
- POJ 2393-Yogurt factory 贪心算法
- 文件属修改器!(创建时间、修改时间等属性修改)
- linux下出现undefined reference to `mysql_init' 的解决方法
- Linux下的多线程编程
- 错误集锦5--“std::ios_base::Init::Init()”,referenced from 错误
- Tag Archives: Workflow Auto Cleanup workflow history disappears
- 关于Activity的启动模式,你知道吗?
- Cocos2d-x 触摸响应事件CCTouchDelegate
- SharePoint 2013 创建web应用程序报错"This page can’t be displayed"