1 2
50.00%
#include<iostream> using namespace std; int main() { int n; double ls[21]={0,0,1}; double gq[21]={1,1,2}; for(int i=3;i<21;i++) { gq[i]=gq[i-1]*i; ls[i]=(i-1)*(ls[i-1]+ls[i-2]); } cin>>n;int t; while(n--) { cin>>t; printf("%.2lf%%\n",ls[t]/gq[t]*100); } return 0; }
原文地址:http://blog.csdn.net/lsgqjh/article/details/44962255