求阶乘的和

Luogu
IDLGB2153
Time1000ms
Memory512MB
DifficultyP1
循环结构
给定正整数 $n$,求不大于 $n$ 的正整数的阶乘的和(即求 $1!+2!+3!+\dots+n!$),输出阶乘的和。 阶乘定义为 $n!=n\times (n-1)\times (n-2)\times \cdots \times 1$。例如,$5! = 5 \times 4 \times 3 \times 2 \times 1=120$。 ## Input 输入一行,包含一个正整数 $n(1 < n < 12)$。 ## Output 输出一行,表示阶乘的和。 [samples]
Samples
Input #1
5
Output #1
153
API Response (JSON)
{
  "problem": {
    "name": "求阶乘的和",
    "description": {
      "content": "给定正整数 $n$,求不大于 $n$ 的正整数的阶乘的和(即求 $1!+2!+3!+\\dots+n!$),输出阶乘的和。 阶乘定义为 $n!=n\\times (n-1)\\times (n-2)\\times \\cdots \\times 1$。例如,$5! = 5 \\times 4 \\times 3 \\times 2 \\times 1=120$。",
      "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": "LGB2153"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定正整数 $n$,求不大于 $n$ 的正整数的阶乘的和(即求 $1!+2!+3!+\\dots+n!$),输出阶乘的和。\n\n阶乘定义为 $n!=n\\times (n-1)\\times (n-2)\\times \\cdots \\times 1$。例如,$5! = 5 \\times 4 \\times 3 \\times 2 \\times 1=120$。\n\n## Input\n\n输入一行,包含一个正整数 $n...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments