杭电------2048神上帝以及老天爷(C语言写)

时间:2024-10-04 21:03:56
#include<stdio.h>
long long a[] = { -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,- };
long long b[] = { };
long long jiecheng(int n) {
if (b[n]>) {
return b[n];
}
return b[n] = jiecheng(n - )*n;
}
long long recrusion(int n) {
if (a[n] > -)
return a[n];
return a[n] = (n - )*(recrusion(n - ) + recrusion(n - ));
} int main() {
int n, m;
int i;
b[] = ;
b[] = ;
a[] = ;
a[] = ;
double x;
scanf("%d", &n);
for (i = ; i < n; i++) {
scanf("%d", &m);
x = (double)recrusion(m) / (double)jiecheng(m);
printf("%.2lf%%\n", x * );
}
return ;
}(m大于7时概率不再变化)