Description
Input
Output
Sample Input
4 20
Sample Output
0.66667 0.28377
把图画出来,枚举全部的可能,然后多试几组就能知道增长规律了
#include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<vector> #include<iostream> #include<algorithm> #include<bitset> #include<functional> using namespace std; typedef unsigned long long ull; typedef long long LL; const int maxn = 1e5 + 10; int T, n, m; double f[maxn]; void Scan(int &x) { char ch; while ((ch = getchar()) > '9' || ch < '0'); int res = ch - '0'; while ((ch = getchar()) <= '9'&&ch >= '0') res = res * 10 + ch - '0'; x = res; } bool check(int x) { int u = sqrt(x); return u*u == x; } void init() { f[2] = 1; for (int i = 4; i <= 100; i += 2) { f[i] = f[i - 2] * (i - 2) / (i - 1); } } int main() { init(); while (scanf("%d", &n) != EOF) { printf("%.5lf\n", f[n]); } return 0; }