https://www.luogu.org/problemnew/show/P1968

也是一道贪心题,一些计算;

然而我却弄得很复杂;

既然我们要的是最后的最大值,那我们为什么要注意中间的细节呢;

记录每天我们能拿到的最大值,然后输出,完美结束;

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=;
int n;
double to_us[maxn],to_mark[maxn],a[maxn];
int cnt,vis;
double ans=,ans2=;
double max_us=,max_mark;
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%lf",a+i);
to_mark[i]=a[i]/;
to_us[i]=/a[i];
}
for(int i=;i<=n;i++)
{
max_us=max(max_us,max_mark*to_us[i]);
max_mark=max(max_mark,max_us*to_mark[i]);
}
printf("%.2lf",max_us);
return ;
}

最新文章

  1. win10磁盘100%解决办法
  2. 动画的使用&mdash;View Animation
  3. 谷歌console开发人员官方文档(注意是谷歌)
  4. MongoDB ObjectId
  5. HDU1412
  6. hug and Compression Resistance
  7. WebForm Repeater的事件、后天数据展示--2017年1月8日
  8. strace使用详解(转) 分类: shell ubuntu 2014-11-27 17:48 134人阅读 评论(0) 收藏
  9. Javascript兑现图片预加载【回调函数,多张图片】 (转载)
  10. 2018-2019 20165235 网络对抗 Exp5 MSF基础
  11. hdu 3613&quot;Best Reward&quot;(Manacher算法)
  12. python学习路线--从入门到入土
  13. IDEA文件对比
  14. Java 8 的 Metaspace
  15. oracle 62进制序列号
  16. Mybatis系列(四):Mybatis缓存
  17. discuz回贴通知插件实现-发送邮件
  18. iptables 生产环境下基础设置
  19. 虚拟机如何装LINUX
  20. 简话Angular 00 为什么要学Angular

热门文章

  1. AES密码算法详解(转自https://www.cnblogs.com/luop/p/4334160.html)
  2. R语言错误的提示(中英文翻译)
  3. Python笔记-备忘
  4. Node中的net模块提供的前端通信
  5. 2019 GIAC-全球互联网架构大会课件
  6. vim调试Shell脚本: unexpected EOF while looking for matching
  7. asp.net mvc 防止跨站攻击
  8. Computer Vision_33_SIFT:Distinctive Image Features from Scale-Invariant Keypoints——2004
  9. Nginx的简单了解与使用
  10. ubuntu下后台服务的管理