PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000274. Điểm nguyên trên đường thẳng (Line)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Điểm nguyên trên đường thẳng (Line)
Line
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A line on the coordinate plane is given by , where .
Find any integer point on this line, with both coordinates in .
If no such integer point exists, output -1. Any valid point is accepted.
Input
One line contains three integers .
Output
Print two integers defining any valid point, or -1 if none exists.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Example 1
Input
2 5 3
Output
6 -3
Explanation
Substitution gives .