写法和CF235B Let's Play Osu!非常相似。但是这个题厉害就厉害在统计的贡献里面有一个平方的期望,而这个平方的期望和期望的平方是完全不一样的,需要另外统计,逻辑上仔细想一想就会明白。

期望\(dp\)没那么可怕,但是确实非常不容易调试。所以一定要在第一次推出式子的时候,保证式子的正确。哪怕先写一个暴力,也比写出锅过不了样例根本没法调的正解要好。

#include <bits/stdc++.h>
using namespace std; const int N = 100010; int n; double p[N], E1[N], E2[N], ans; int main () {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> p[i];
E1[i] = p[i] * (E1[i - 1] + 1);
E2[i] = p[i] * (E2[i - 1] + 2 * E1[i - 1] + 1);
ans += p[i] * (3 * E2[i - 1] + 3 * E1[i - 1] + 1);
}
printf ("%.1lf\n", ans);
}

最新文章

  1. iOS开发的知名大牛博客小汇
  2. hibernate联合主键 注解方式
  3. Android 开发必备知识:我和 Gradle 有个约会
  4. Android的学习——ubuntu下android5.1源码的make编译
  5. 谈谈eclipse使用技巧二
  6. 设计模式-&gt;观察者模式
  7. 禁止苹果浏览器Safari将数字识别成电话号码的方法
  8. 学习VS生活
  9. ASP.NET MVC 表单的几种提交方式
  10. 让 BAT 的 Offer 不再难拿
  11. iOS中block实现的探究
  12. virtual box Failed to load unit &quot;&quot;pgm&quot; 的error
  13. java学习(四) excel读取
  14. 全景智慧城市——NOW!!!VRSHOPPING颠覆你的购物认知!
  15. 201521123026 《java程序设计》 第九周学习总结
  16. LVS集群之工作原理和调度算法(2)
  17. 由会话信息保存认识ThreadLocal
  18. APP测试要点—UI、功能测试
  19. TTL 和 DNS TTL 的区别
  20. JS实现定时任务,每隔N秒请求后台——setInterval定时和ajax请求

热门文章

  1. 实现MongoDB读写分离的“读偏好”介绍
  2. The account that is running SQL Server Setup does not have one or all of the following rights: the right to back up files and directories, the right to manage auditing and the security log and the rig
  3. 20181218 - PostgreSQL Auto Commit Guide(自动提交)
  4. Python 序列化模块(json,pickle,shelve)
  5. 【原】Java学习笔记022 - 字符串
  6. local_irq_disable和disable_irq的区别
  7. centos后台运行Python
  8. 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectException: Connection refused to host: 127.0.0.1 异常原因及解决方案
  9. springMVC DispatcherServlet类关系图
  10. Python编码规范(PEP8)及奇技淫巧(不断更新)