Cod sursa(job #2789313)
Utilizator | Data | 27 octombrie 2021 13:18:15 | |
---|---|---|---|
Problema | Dezastru | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream>
using namespace std;
ifstream F("dezastru.in");
ofstream G("dezastru.out");
short n,k,i,j;
float v[30],f;
int main()
{
for(F>>n>>k,v[0]=1.0f,i=1;i<=n;++i)
for(F>>f,j=i;j>0;--j)
v[j]=((float)j)/i*f*v[j-1]+(((float)i)-j)/i*v[j];
G<<v[k];
return 0;
}