标签:
Description
Input
Output
Sample Input
sample input |
sample output |
100 2 50 |
90.00000
|
水题,推个公式出来,注意精度...一遍A
1 /************************************************************************* 2 > File Name: code/2015summer/#5/D.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年07月30日 星期四 13时17分26秒 6 ************************************************************************/ 7 8 #include<iostream> 9 #include<iomanip> 10 #include<cstdio> 11 #include<algorithm> 12 #include<cmath> 13 #include<cstring> 14 #include<string> 15 #include<map> 16 #include<set> 17 #include<queue> 18 #include<vector> 19 #include<stack> 20 #define y0 abc111qqz 21 #define y1 hust111qqz 22 #define yn hez111qqz 23 #define j1 cute111qqz 24 #define tm crazy111qqz 25 #define lr dying111qqz 26 using namespace std; 27 #define REP(i, n) for (int i=0;i<int(n);++i) 28 typedef long long LL; 29 typedef unsigned long long ULL; 30 const int inf = 0x7fffffff; 31 int s,m,p; 32 double ans; 33 34 double cal(double x,int n) 35 { 36 double res = 1.0; 37 for ( int i = 1 ; i <= n ; i++ ) 38 { 39 res = res * x; 40 } 41 // cout<<"res:"<<res<<endl; 42 return res; 43 } 44 int main() 45 { 46 cin>>s>>m>>p; 47 double sum = 0; 48 double per = p*1.0/100+1; 49 for ( int i = 1 ; i <= m; i++ ) 50 { 51 sum=sum+1.0/cal(per,i); 52 // cout<<"sum:"<<sum<<endl; 53 } 54 // cout<<sum<<endl; 55 cout<<fixed<<setprecision(5)<<s*1.0/sum<<endl; 56 57 return 0; 58 }
SGU 456 Annuity Payment Scheme
标签:
原文地址:http://www.cnblogs.com/111qqz/p/4690432.html