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

Bài tập thuộc lộ trình

1 lộ trình

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 x,kx,k, find integers p,qp,q 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 x,kx,k.

Output

Print integers p,qp,q on one line.

Subtasks

  • Subtask 1 (20 points): 1≤x,k≤1001\le x,k\le 100; p,qp,q fit signed 64-bit integers.
  • Subtask 2 (30 points): 1≤x,k≤1000001\le x,k\le 100000; p,qp,q fit signed 64-bit integers.
  • Subtask 3 (50 points): 1≤x,k≤999999991\le x,k\le 99999999; p,qp,q fit signed 64-bit integers.

Examples

Example 1

Input

5 2

Output

1 1

Explanation

⌊5/2⌋=2\lfloor 5/2\rfloor=2 and ⌈5/2⌉=3\lceil 5/2\rceil=3. With p=1,q=1p=1, q=1: 1⋅2+1⋅3=51\cdot 2+1\cdot 3=5.

Example 2

Input

40 2

Output

0 2

Explanation

⌊40/2⌋=20\lfloor 40/2\rfloor=20 and ⌈40/2⌉=20\lceil 40/2\rceil=20. With p=0,q=2p=0, q=2: 0⋅20+2⋅20=400\cdot 20+2\cdot 20=40.

Example 3

Input

24444 6

Output

0 6

Explanation

⌊24444/6⌋=4074\lfloor 24444/6\rfloor=4074 and ⌈24444/6⌉=4074\lceil 24444/6\rceil=4074. With p=0,q=6p=0, q=6: 0⋅4074+6⋅4074=244440\cdot 4074+6\cdot 4074=24444.