A - Sum of Two Integers
Editorial
/
Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
合計が N となるように相異なる 2 つの正整数を選ぶ方法は何通りあるでしょうか (順序は考慮しません)。
制約
- 1 ≦ N ≦ 10^6
- N は整数である。
入力
入力は以下の形式で標準入力から与えられる。
N
出力
答えを出力せよ。
入力例 1
4
出力例 1
1
合計が 4 となるように相異なる 2 つの正整数を選ぶ方法は、1 と 3 を選ぶ 1 通りのみです。(3 と 1 を選ぶことはこれと区別しません。)
入力例 2
999999
出力例 2
499999
Score : 100 points
Problem Statement
How many ways are there to choose two distinct positive integers totaling N, disregarding the order?
Constraints
- 1 \leq N \leq 10^6
- N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the answer.
Sample Input 1
4
Sample Output 1
1
There is only one way to choose two distinct integers totaling 4: to choose 1 and 3. (Choosing 3 and 1 is not considered different from this.)
Sample Input 2
999999
Sample Output 2
499999