标签:
1 2
50.00%
#include<iostream> #include<algorithm> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<iomanip> using namespace std; double num[101]; int n; int main() { int T; num[1] = 0; num[2] = 1; for(int i=3;i<=20;i++) { num[i] = (i-1)*(num[i-2] + num[i-1]); } scanf("%d",&T); while(T--) { scanf("%d",&n); double sum = 1; for(double i=2;i<=n;i++) { sum *= i; } double pcnt; pcnt = num[n]/sum; printf("%.2lf%%\n",pcnt*100); } return 0; }
标签:
原文地址:http://blog.csdn.net/yeguxin/article/details/45498429