Number of ways to find two numbers
Submissions: 2322   Accuracy:

57.69%

  Difficulty: Easy   Marks: 2

You will be given a positive integer K. Your task is to find the number of ordered pairs of positive integers (a,b) where 1 a < b < K such that a + bK.

 

Input:
The first line of input contains a single integer T denoting the number of test cases.
Then T test cases follow. The first and only line of each test case consists of K.

 

Output:
Corresponding to each test case, in a new line, print the number of ordered pairs of positive integers (a,b) where 1 a < b < K such that a + bK.

 

Constraints:
1 ≤ T ≤ 100
1 ≤ K ≤ 1000

 

Example:

Input
3
2
4
5

Output
0
2
4

 

Explanation:
For K = 4, the two ordered pairs are (1,2) and (1,3). For K = 5, the four ordered pairs (1,2), (1,3), (1,4) and (2,3). 

** For More Input/Output Examples Use 'Expected Output' option **

Author: Hemang Sarkar


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.