PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000044. Dựng cặp có tổng UCLN và BCNN cho trước (EhAb AnD gCd)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Dựng cặp có tổng UCLN và BCNN cho trước (EhAb AnD gCd)
EhAb AnD gCd
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given integer , find any positive integers satisfying $$\gcd(a,b)+\operatorname{lcm}(a,b)=x.$$ A solution is guaranteed. Any valid ordered pair is accepted.
Input
One line contains .
Output
Print positive integers separated by one space.
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
14
Output
1 13
Explanation
For , the GCD is and the LCM is , giving total . Other valid pairs are accepted.