PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000075. BCNN nhỏ nhất của hai số có tổng cố định (Minimum LCM)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
BCNN nhỏ nhất của hai số có tổng cố định (Minimum LCM)
Minimum LCM
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , split it into a sum of two positive integers and . Among all such splits, minimize . If multiple optimal pairs exist, print any one.
Input
One integer .
Output
Print two positive integers whose sum is and whose LCM is minimum.
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Input
10
Output
5 5
Explanation
The pair sums to and has LCM . Other unordered pairs have LCMs , all larger than .