akoj-1280另类阶乘问题

另类阶乘问题

Time Limit:3000MS  Memory Limit:65536K

Total Submit:22 Accepted:20

Description

大家都知道阶乘这个概念,举个简单的例子:5!=12345.现在我们引入一种新的阶乘概念,将原来的每个数相乘变为i不大于n的所有奇数相乘例如:5!!=135.现在明白现在这种阶乘的意思了吧!现在你的任务是求出1!!+2!!……+n!!的正确值(n<=20)

Input

第一行输入一个a(a<=20),代表共有a组测试数据 

接下来a行各行输入一个n.

Output

各行输出结果一个整数R表示1!!+2!!……+n!!的正确值

Sample Input

2
3
5

Sample Output

5
23
#include 
long long  jie(int n)
{
    int i;
    long long s = 1;
    for (i = 1; i <= n; i +="2)" { s *="i;" } return s; long result(int k) int i; for ( <="k;" ++i) main() scanf("%d", &n); while (n--) k; &k); printf("%d\n", result(k)); 0; }< pre>

坚持原创技术分享,您的支持将鼓励我继续创作!
  • 本文作者: Fayne
  • 本文链接: 390.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!