#P2158. [SDOI2008] 仪仗队

    ID: 2940 遠端評測題 1000ms 125MiB 嘗試: 29 已通過: 10 显示难度提高 上傳者: 標籤>2008各省省选山东素数判断,质数,筛法欧拉函数

[SDOI2008] 仪仗队

Problem Description

As the sports committee member, Mr. C is responsible for training the honor guard for this sports meet. The honor guard is an N×NN \times N square formation of students. To ensure the formation marches in perfect order, Mr. C follows at the back-left of the formation and judges whether it is neat based on the number of students visible to him (as shown in the figure).

Now, Mr. C wants you to tell him the number of students he can see when the formation is neat.

Input Format

One line with a positive integer NN.

Output Format

Output one line with a single number: the number of students Mr. C should see.

4
9

Hint

Constraints: For 100%100\% of the testdata, 1≤N≤400001 \le N \le 40000.

Translated by ChatGPT 5