#P6269. [SHOI2002] 空中都市

    ID: 7059 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 显示难度普及 上传者: 标签>数学图论2002各省省选上海

[SHOI2002] 空中都市

Problem Description

In the future aerial city, there are many small islands (city districts). Now we want to build bridges between these islands. Each bridge is a passage connecting two islands.

There is an agreement: if there is a bridge between AA and BB, and there is a bridge between BB and CC, then no bridge can be built between AA and CC. That is, for any three islands in the city, you cannot build bridges between every pair of them. Under this agreement, find the maximum possible number of bridges. You do not need to consider the actual spatial structure.

Input Format

The input file contains only one line, which contains a single non-negative integer n (0n1000)n \ (0 \leq n \leq 1000), representing the number of islands.

Output Format

The output file also contains only one line, which is the maximum number of bridges that can be built.

6
9
11
30

Hint

Translated by ChatGPT 5