P1968 美元汇率 怀疑智商超过海平面
2024-09-05 03:17:28
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 ;
}
最新文章
- win10磁盘100%解决办法
- 动画的使用&mdash;View Animation
- 谷歌console开发人员官方文档(注意是谷歌)
- MongoDB ObjectId
- HDU1412
- hug and Compression Resistance
- WebForm Repeater的事件、后天数据展示--2017年1月8日
- strace使用详解(转) 分类: shell ubuntu 2014-11-27 17:48 134人阅读 评论(0) 收藏
- Javascript兑现图片预加载【回调函数,多张图片】 (转载)
- 2018-2019 20165235 网络对抗 Exp5 MSF基础
- hdu 3613";Best Reward";(Manacher算法)
- python学习路线--从入门到入土
- IDEA文件对比
- Java 8 的 Metaspace
- oracle 62进制序列号
- Mybatis系列(四):Mybatis缓存
- discuz回贴通知插件实现-发送邮件
- iptables 生产环境下基础设置
- 虚拟机如何装LINUX
- 简话Angular 00 为什么要学Angular
热门文章
- AES密码算法详解(转自https://www.cnblogs.com/luop/p/4334160.html)
- R语言错误的提示(中英文翻译)
- Python笔记-备忘
- Node中的net模块提供的前端通信
- 2019 GIAC-全球互联网架构大会课件
- vim调试Shell脚本: unexpected EOF while looking for matching
- asp.net mvc 防止跨站攻击
- Computer Vision_33_SIFT:Distinctive Image Features from Scale-Invariant Keypoints——2004
- Nginx的简单了解与使用
- ubuntu下后台服务的管理