POJ 2323 贪心
来源:互联网 发布:网易uu打不开修复网络 编辑:程序博客网 时间:2024/04/28 04:21
题意:
思路:
贪
贪
贪
如果当前的c>之前的c+s 那么之前的合适 一直贪下去就好了
//By SiriusRen#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define int long longint n,s,rec=1,c[10500],y[10500],ans;signed main(){ scanf("%lld%lld",&n,&s); for(int i=1;i<=n;i++) scanf("%lld%lld",&c[i],&y[i]); for(int i=1;i<=n;i++){ if(c[i-1]+s<c[i])ans+=y[i]*(c[rec]+s*(i-rec)); else rec=i,ans+=y[i]*c[i]; } printf("%lld\n",ans);}
0 0
- POJ 2323 贪心
- poj 1017 Packets【贪心】
- POJ 1017 Packets(贪心)
- POJ 1323 简单贪心
- POJ 1065 (贪心)
- POJ 1328 贪心
- POJ 1018 贪心思想
- POJ 1089 贪心算法
- poj 1017 Packets(贪心)
- poj 1017 贪心算法
- poj 1328 贪心
- POJ 3544 贪心
- POJ-1456 Supermarket【贪心】
- poj 1024 贪心、枚举
- Poj 1328 贪心
- POJ 1018 枚举+贪心
- poj 2709 贪心
- POJ 1328(贪心)
- Vue.js笔记-数据绑定
- 二叉树大全
- An overview of gradient descent optimization algorithms
- 《图解HTTP》笔记——返回结果的HTTP状态码(第四章)
- R精通必看书籍推荐
- POJ 2323 贪心
- jmx 接口访问数据
- Linux通过PID查看进程完整信息
- 不通过GwtTestCase测试GWT
- 在栈上new出一个对象
- android 全屏以及透明状态栏总结
- An overview of gradient descent optimization algorithms
- 简单的c语言程序
- GitHub上史上最全的iOS开源项目分类汇总