poj 2683 Ohgas#39; Fortune 利率计算
生活随笔
收集整理的這篇文章主要介紹了
poj 2683 Ohgas#39; Fortune 利率计算
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
水題。
代碼:
//poj 2683 //sep9 #include <iostream> using namespace std;int main() {int cases;scanf("%d",&cases);while(cases--){int fund,year,op,ans=-1;scanf("%d%d%d",&fund,&year,&op);while(op--){int A,B,flag,charge;double rate;scanf("%d%lf%d",&flag,&rate,&charge);A=fund;if(flag==1){for(int i=0;i<year;++i){B=(int)A*rate;A=A+B-charge;}}else{int cumulative=0;for(int i=0;i<year;++i){B=(int)A*rate;A-=charge;cumulative+=B;}A+=cumulative; }ans=max(ans,A);}printf("%d\n",ans);}return 0; }總結
以上是生活随笔為你收集整理的poj 2683 Ohgas#39; Fortune 利率计算的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux系统性能监控之6个vmstat
- 下一篇: [译] 基于事件流构建的服务