[语言月赛202305] 计算阶乘

Luogu
IDLGB3764
Time1000ms
Memory512MB
DifficultyP1
2023O2优化循环结构语言月赛
给定整数 $n$,请你求出 $2 \times \dfrac{n!}{n!!}$ 的值。 ## Input **本题单测试点内有多组测试数据**。 输入的第一行是一个整数,表示数据组数 $T$。接下来依次给出每组数据的输入信息。 对每组数据,输入只有一行一个整数表示给定的 $n$。 ## Output 对每组数据,输出一行一个整数表示 $2 \times \dfrac{n!}{n!!}$ 的值。 [samples] ## Background 相信你已经知道**阶乘**的定义: $$n! = n \times (n - 1) \times (n - 2) \times \dots 1$$ 现在,我们给出**双阶乘**的定义: 当 $n$ 为奇数时, $$n!! = n \times (n - 2) \times (n - 4) \times \dots \times 1$$ 当 $n$ 为偶数时, $$n!! = n \times (n - 2) \times (n - 4) \times \dots \times 2$$ 特别的,$0!! = 1$。 例如,$5!! = 5 \times 3 \times 1 = 15$,$6!! = 6 \times 4 \times 2 = 48$。 ## Note ## 数据规模与约定 - 对 $20\%$ 的数据,$n \leq 2$。 - 对 $60\%$ 的数据,$n \leq 9$。 - 对 $100\%$ 的数据,$0 \leq n \leq 34$,$1 \leq T \leq 35$。 ## 提示 $2 \times \dfrac {34!}{34!!} < 2^{64}$。
Samples
Input #1
1
2
Output #1
2
Input #2
1
3
Output #2
4
API Response (JSON)
{
  "problem": {
    "name": "[语言月赛202305] 计算阶乘",
    "description": {
      "content": "给定整数 $n$,请你求出 $2 \\times \\dfrac{n!}{n!!}$ 的值。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB3764"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定整数 $n$,请你求出 $2 \\times \\dfrac{n!}{n!!}$ 的值。\n\n## Input\n\n**本题单测试点内有多组测试数据**。\n\n输入的第一行是一个整数,表示数据组数 $T$。接下来依次给出每组数据的输入信息。\n\n对每组数据,输入只有一行一个整数表示给定的 $n$。\n\n## Output\n\n对每组数据,输出一行一个整数表示 $2 \\times \\dfrac{n!}{n!!}...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments