304210: CF804A. Find Amir

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Find Amir

题意翻译

题面: 有n座城市,标号为1~n,定义标号为i,j的两座城市的距离为(i+j)%(n+1).求走完所有城市所需的最小花费(起点任意). 输入格式: 仅一个n. 输出格式: 走完所有城市的最小距离. 翻译贡献者:尘染梦

题目描述

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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF804A/36e0af0ffb6d8d5118f47b9d6d08ec0cbc4d1101.png) 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.

输入输出格式

输入格式


The first line contains a single integer $ n $ ( $ 1<=n<=10^{5} $ ) — the number of schools.

输出格式


Print single integer: the minimum cost of tickets needed to visit all schools.

输入输出样例

输入样例 #1

2

输出样例 #1

0

输入样例 #2

10

输出样例 #2

4

说明

In the first example we can buy a ticket between the schools that costs ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF804A/a7e2487aa779c1a0ea41f5a275a88d0bb6d646b7.png).

Input

题意翻译

题面: 有n座城市,标号为1~n,定义标号为i,j的两座城市的距离为(i+j)%(n+1).求走完所有城市所需的最小花费(起点任意). 输入格式: 仅一个n. 输出格式: 走完所有城市的最小距离. 翻译贡献者:尘染梦

加入题单

上一题 下一题 算法标签: