[信息与未来 2016] 数列求和

Luogu
IDLGB4136
Time1000ms
Memory128MB
DifficultyP1
数学2016江苏信息与未来
小明写出了一个数列,第 $i$ 项 $a_i$ 的值为 $i^2$。数列从第一项 $(i=1)$ 开始如下:$1,4,9,16,25,\dots$,编程求出这个数列前 $n$ 项的和。 ## Input 一行,一个整数 $n$。 ## Output 一行,一个整数:$a_1+a_2+\dots+a_n$ 的值。 [samples] ## Note $1\leq n \leq 10^{12}$。 **本题相较于原题数据有所加强,使用 C++ 的 `long long` 无法通过 $100\%$ 数据,你或许需要使用 `unsigned __int128`。** >本题原始满分为 $10\text{pts}$。
Samples
Input #1
6
Output #1
91
Input #2
987
Output #2
320988850
API Response (JSON)
{
  "problem": {
    "name": "[信息与未来 2016] 数列求和",
    "description": {
      "content": "小明写出了一个数列,第 $i$ 项 $a_i$ 的值为 $i^2$。数列从第一项 $(i=1)$ 开始如下:$1,4,9,16,25,\\dots$,编程求出这个数列前 $n$ 项的和。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4136"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小明写出了一个数列,第 $i$ 项 $a_i$ 的值为 $i^2$。数列从第一项 $(i=1)$ 开始如下:$1,4,9,16,25,\\dots$,编程求出这个数列前 $n$ 项的和。\n\n## Input\n\n一行,一个整数 $n$。\n\n## Output\n\n一行,一个整数:$a_1+a_2+\\dots+a_n$ 的值。\n\n[samples]\n\n## Note\n\n$1\\leq n \\leq 10^{...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments