标签:ott opened following net room 打开 some contains typedef
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <bitset> using namespace std; typedef long long LL; #define MOD 1000000007 LL fac[25],s[25][25],n,k,T; int main(){ // freopen("test.in","r",stdin); cin >> T; fac[1] = 1; s[0][0] = 0; s[1][1] = 1; s[1][0] = 0; for (int i=2;i<=21;i++){ fac[i] = fac[i-1] * i; s[i][0] = 0; for (int j=1;j<=i;j++){ s[i][j] = s[i-1][j-1] + (i-1) * s[i-1][j]; } } for (int i=1;i<=T;i++){ cin >> n >> k; LL ans = 0; for (int j=1;j<=k;j++){ ans += s[n][j] - s[n-1][j-1]; } double anss = ans * 1.0; printf("%.4lf\n",anss/fac[n]); } return 0; }
标签:ott opened following net room 打开 some contains typedef
原文地址:http://www.cnblogs.com/ToTOrz/p/7389630.html