挖煤(coal)


solution

我好弱,啥也想不到。

想了很久dp,这有后效性啊。

结果倒着做就可以了,因为后面的不会影响前面的。

考虑前面的影响后面:挖煤相当于让后面所有a[I]*(1+k%)

#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
int n,a[100005],op[100006];
double k,c,w,f[100005];
int main()
{
cin>>n>>k>>c>>w;
for(int i=1;i<=n;i++)scanf("%d%d",&op[i],&a[i]);
for(int i=n;i>=1;i--){
if(op[i]==1)f[i]=max(f[i+1],f[i+1]*(1-k/100)+a[i]);
else f[i]=max(f[i+1],f[i+1]*(1+c/100)-a[i]);
}
printf("%.2lf\n",f[1]*w);
return 0;
}

最新文章

  1. [转]如何在ASP.NET Core中实现一个基础的身份认证
  2. saltstack 入门命令
  3. GITHUB使用简介
  4. highchars
  5. NOIP2001 Car的旅行路线
  6. Ansj分词双数组Trie树实现与arrays.dic词典格式
  7. [zz]android的logcat详细用法
  8. java把InputStram 转换为String
  9. centos 下mysql操作
  10. 如何用C#把Doc文档转换成rtf格式
  11. eclipse 快捷方式大全
  12. Day 1: How to install jedi/codeintel plugin for sublime on Linux
  13. DB2的基础指令 学习笔记
  14. 《算法导论》习题2.3-6 改进的InsertSort
  15. Java常用集合体系以及相互区别
  16. Python可视化----------matplotlib.pylot
  17. Could not create pool connection. The DBMS driver exception was: null, message from server: &quot;Host &#39;192.168.XX.XX&#39; is blocked because of many connection errors; unblock with &#39;mysqladmin flush-hosts&#39;
  18. 使用VS+OpenCV调用深度学习模型
  19. laravel5的Bcrypt加密方式对系统保存密码的小结
  20. Java并发编程--6.Exchanger线程间交换数据

热门文章

  1. 机器学习中正则化项L1和L2的直观理解
  2. tk.mybatis Example 多个or条件拼接
  3. Java - 类加载的时候,是有缺省同步锁的
  4. 嵌入式开发 centos7 交叉编译环境准备
  5. python笔记-dict字典的方法
  6. PHP使用CURL_MULTI实现多线程采集
  7. spark入门: wordcount-java
  8. printf(&quot;\033[1;33m ***** \033[0m \n&quot;);
  9. POJ:2185-Milking Grid(KMP找矩阵循环节)
  10. greenplum-时间处理