1017. Rate of Return
来源:互联网 发布:云购网站源码 编辑:程序博客网 时间:2024/06/06 15:37
二分。
#include <iostream>#include <cmath>#include <iomanip>using namespace std;int main(){int t,mark=1;double month[20],money[20],lastMonth,lastMoney;while(cin>>t&&t!=-1){for(int z=1;z<=t;z++)cin>>month[z]>>money[z];cin>>lastMonth>>lastMoney;double rate=2,low=1,mid;while(rate-low>=1e-6){mid=(rate+low)/2;double sum=0;for(int i=1;i<=t;i++)sum+=money[i]*pow(mid,lastMonth-month[i]+1);if(sum<lastMoney) low=mid;else rate=mid;}if(mark>1) cout<<endl;cout<<"Case "<<mark++<<": "<<fixed<<setprecision(5)<<low-1<<endl;}return 0;}
- 1017. Rate of Return
- 1017. Rate of Return
- sicily 1017. Rate of Return
- [sicily online]1017. Rate of Return
- 1017 Rate of Return
- sicily1017 Rate of Return
- Internal Rate Of Return - IRR
- 1017. Rate of Return (用二分法求近似解)
- UVA 11881(Internal Rate of Return)二分法
- UVA 11881 Internal Rate of Return
- toj 4609 Internal Rate of Return
- POJ-2199(一元n次方程,二分答案)(Rate of Return )
- 第六届省赛 E Internal Rate of Return(UVA 11881)二分求根
- POJ-2199 Rate of Return【二分求解一元高次方程】
- Principle of Rate Control Algorithm TMN5
- Success Rate of iBots in OBIEE
- Understanding different types of bit-rate encoding
- The Maximum Data Rate of a Channel
- (08) 需求征集 -- 消息管理
- 通达OA 那个即时通讯的服务总是无故报错,即时通讯人员列表白板,开发程序解决!
- (09) 需求征集 -- 基础编码管理(例如下拉框数据管理)
- (10) 需求征集 -- 权限管理
- 处理 Exists
- 1017. Rate of Return
- (11) 需求征集 -- 授权管理、委托管理、扮演管理
- ASM PPT Template
- (12) 需求征集 -- 序列管理、编号管理
- js放大镜效果
- C++学习第5篇-变量范围及其他数据类型
- FileReader的编码问题
- oracle 移动窗口基线
- (13) 需求征集 -- 参数管理