问题 AW: Find Amir

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:11 通过:10

题目描述

A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.

There are $ n $ schools numerated from $ 1 $ to $ n $ . One can travel between each pair of them, to do so, he needs to buy a ticket. The ticker between schools $ i $ and $ j $ costs $(i + j) \ mod \ (n + 1)$ and can be used multiple times. Help Sajjad to find the minimum cost he needs to pay for tickets to visit all schools. He can start and finish in any school.


几年前,出于安全考虑,萨贾德离开了自己的学校,转到了另一所学校。现在他想找到阿米尔,他的一个同学和好朋友。

总共有$n$个学校,编号$1$到$n$。他从一个学校可以到任意另一个学校,不过这样做,他需要买一张票。学校$ i $和$ j $之间的票价为$(i + j) \ mod \ (n + 1)$,并且一张票可以多次使用。请你帮助萨贾德找到他需要支付的拜访所有学校的票的最低费用。他可以在任何一所学校开始和结束。

输入样例 复制

2

输出样例 复制

0

数据范围与提示

样例输入#1

2

样例输出#1

0

样例输入#2

10

样例输出#2

4
In the first example we can buy a ticket between the schools that costs.
在第一个样例中我们可以买一张票花费$(1 + 2) \ mod \ (2 + 1) = 0$