PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000097. Tìm hai số có tích chia hết – bản dễ (Divisible Numbers, Easy Version)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tìm hai số có tích chia hết – bản dễ (Divisible Numbers, Easy Version)
Divisible Numbers (easy version)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given four positive integers with and , find integers such that , , and the product is divisible by . Print any valid pair, or -1 -1 if no pair exists.
Input
One line contains in this order.
Output
Print and separated by a space, or -1 -1 if no solution exists.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
3 4 5 7
Output
4 6
Explanation
The pair , satisfies and . Moreover is divisible by . Thus 4 6 is a valid answer, although other answers may exist.