#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
double factorial(double n)
{
if (n)
{
return n*factorial(n - 1);
}
else
{
return 1;
}
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
double lambda, k;
cin >> lambda >> k;
cout << fixed << setprecision(3) << pow(lambda, k)*exp(-lambda) / factorial(k) << endl;
return 0;
}
2 Responses
good to see some C++ on here ! keep up the good work !!
Write a 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.