Largest Proper fraction
Submissions: 355   Accuracy:

29.04%

  Difficulty: Easy   Marks: 2

Given a number N. Find the values of a and b such that a/b is the largest proper fraction and a + b = N. Following are constraints for fraction.

  1. a/b is a proper fraction if a is less than b and a and b are co-primes i.e no common factor of a and b.
  2. There can be multiple proper fractions with sum of numerator and denominator equal to a given number. The main task is to find values of a and b for which the fraction is having the maximum floating point value.

Input:
The first line consists of an integer T i.e number of test cases. The first and only line of each test case consists of an integer N

Output:
Print the values of a and b with spaces in between.

Constraints: 
1<=T<=100
3<=n<=105

Example:
Input:

2
3
12
Output:
1 2
5 7

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

Contributor: Saksham Ashtputre
Author: saksham0751


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.