Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.

book
Counting Ordered Pairs

Given an integer n, return the number of ordered pairs of positive integers (a, b) such that a = n - b, where both a and b are positive integers.

Example 1

Input:

2

Output:

1

Example 2

Input:

4

Output:

3

Example 3

Input:

6

Output:

5
main.cpp

main.cpp

C++

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt