PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000277. Làm việc với hàm sàn và hàm trần (Play with Floor and Ceil)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Làm việc với hàm sàn và hàm trần (Play with Floor and Ceil)
Play with Floor and Ceil
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers , find integers such that $$x=p\left\lfloor\frac{x}{k}\right\rfloor+q\left\lceil\frac{x}{k}\right\rceil.$$ Floor rounds down and ceiling rounds up. Any valid pair is accepted as long as both values fit signed 64-bit integers.
Input
One line contains two positive integers .
Output
Print integers on one line.
Subtasks
- Subtask 1 (20 points): ; fit signed 64-bit integers.
- Subtask 2 (30 points): ; fit signed 64-bit integers.
- Subtask 3 (50 points): ; fit signed 64-bit integers.
Examples
Example 1
Input
5 2
Output
1 1
Explanation
and . With : .
Example 2
Input
40 2
Output
0 2
Explanation
and . With : .
Example 3
Input
24444 6
Output
0 6
Explanation
and . With : .