#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
double geomdist(double k, double p)
{
return pow(1 - p, k - 1)*p;
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
double a, b, k;
cin >> a >> b >> k;
double p = a / b;
double s = 0;
/*
for (int i = 1; i <= k; i++)
{
s += geomdist(i, p);
}
*/
cout << fixed << setprecision(3) << geomdist(k, p) << endl;
//cout << fixed << setprecision(3) << s << endl;
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.