1555:计算双阶乘

来源:互联网 发布:ecshop中h5源码购买 编辑:程序博客网 时间:2024/06/06 00:17

1555:计算双阶乘


Description


定义N的双阶乘:

N!!=N*(N-2)*(N-4)*....i(i=1 or i=2)

比如5!!=5*3*1=15

而6!!=6*4*2=48

特别的我们定义0!! = 1!! = 1

给定N 你的任务是计算出N!!(你可以假设答案不超过int 范围)


Input


多组输入,每行一个整数N,你的任务是计算出N!(你可以假设答案不超过int 范围)


Output


你的任务是计算出N!(你可以假设答案不超过int 范围)


Sample Input


5

6


Sample Output


15

48


#include<iostream>using namespace std;int main(){    int N;    while(cin>>N)    {        int count=1;        while(N>0)        {            count=count*N;            N=N-2;        }            cout<<count<<endl;        }return 0;}


原创粉丝点击