Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
266 | 刘家源 | 求解函数 | C++ | Accepted | 0 MS | 292 KB | 344 | 2022-07-22 18:51:15 |
#include<iostream> #include<cstdio> #include<string> #include<iomanip> #include<cmath> using namespace std; double f(int x,int n) { if(n==1) return (double)x/(x+1); else return (double)x/(n+f(x,n-1)); } int main(){ int x,y; cin>>x>>y; cout<<fixed<<setprecision(2)<<f(x,y); return 0; }