CF933D.A Creative Cutout

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Everything red frightens Nian the monster. So do red paper and... you, red on Codeforces, potential or real.

Big Banban has got a piece of paper with endless lattice points, where lattice points form squares with the same area. His most favorite closed shape is the circle because of its beauty and simplicity. Once he had obtained this piece of paper, he prepares it for paper-cutting.

He drew n concentric circles on it and numbered these circles from 1 to n such that the center of each circle is the same lattice point and the radius of the k-th circle is times the length of a lattice edge.

Define the degree of beauty of a lattice point as the summation of the indices of circles such that this lattice point is inside them, or on their bounds. Banban wanted to ask you the total degree of beauty of all the lattice points, but changed his mind.

Defining the total degree of beauty of all the lattice points on a piece of paper with n circles as f(n), you are asked to figure out .

所有红色的东西都会吓到年兽。红纸也会……还有你,Codeforces 上的红色用户——无论是潜在的还是真实的。

大斑斑得到了一张画满无限格点的纸,这些格点构成面积相等的正方形。他最钟爱的封闭图形是圆,因其优美与简洁。获得这张纸后,他便准备用它来剪纸。

他在纸上画了 nn 个同心圆,并将这些圆编号为 11 至 nn,使得每个圆的圆心均为同一个格点,且第 kk 个圆的半径为 倍的格点边长。

定义一个格点的“美丽度”为:所有包含该格点(含边界)的圆的编号之和。斑斑本想请你计算所有格点的美丽度总和,但后来改变了主意。

设在画有 nn 个圆的纸上,所有格点的美丽度总和为 f(n)f(n),现要求你计算 。

输入格式

The first line contains one integer m (1 ≤ m ≤ 1012).

第一行包含一个整数 mm(1≤m≤10121 \leq m \leq 10^{12})。

输出格式

In the first line print one integer representing .

第一行输出一个整数,表示 。

输入输出样例

  • 输入#1

    5

    输出#1

    387
  • 输入#2

    233

    输出#2

    788243189

说明/提示

A piece of paper with 5 circles is shown in the following.

There are 5 types of lattice points where the degree of beauty of each red point is 1 + 2 + 3 + 4 + 5 = 15, the degree of beauty of each orange point is 2 + 3 + 4 + 5 = 14, the degree of beauty of each green point is 4 + 5 = 9, the degree of beauty of each blue point is 5 and the degree of beauty of each gray point is 0. Therefore, f(5) = 5·15 + 4·14 + 4·9 + 8·5 = 207.

Similarly, f(1) = 5, f(2) = 23, f(3) = 50, f(4) = 102 and consequently .

如下图所示,一张纸上画有 5 个圆。

共有 5 种格点:每个红色点的“美观度”为 1+2+3+4+5=151 + 2 + 3 + 4 + 5 = 15,每个橙色点的“美观度”为 2+3+4+5=142 + 3 + 4 + 5 = 14,每个绿色点的“美观度”为 4+5=94 + 5 = 9,每个蓝色点的“美观度”为 55,每个灰色点的“美观度”为 00。因此,f(5)=5⋅15+4⋅14+4⋅9+8⋅5=207f(5) = 5 \cdot 15 + 4 \cdot 14 + 4 \cdot 9 + 8 \cdot 5 = 207。

类似地,f(1)=5f(1) = 5,f(2)=23f(2) = 23,f(3)=50f(3) = 50,f(4)=102f(4) = 102,从而有

输入解题思路,AI测评打分。不知道怎么写?

首页