NYOJ另一种阶乘

来源:互联网 发布:怎么找回淘宝店铺 编辑:程序博客网 时间:2024/06/14 05:51
#include <stdio.h>
int main (){
 int a,shu,t,t1,sum,all;
 scanf("%d",&a);
 while (a--){
 scanf("%d",&shu);
  all=0;
 for (t=1;t<=shu;t++){
  sum=1;
  for (t1=1;t1<=t;t1++){
    if (t1==1||t1%2!=0)
    sum*=t1;
  }
  all+=sum;
 }
 printf("%d\n",all);
 }
return 0;
}
0 0