#QHD0000009. Homer Simpson ăn bánh (Homer Simpson)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Homer Simpson ăn bánh (Homer Simpson)
Homer Simpson
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Homer has minutes to eat burgers. There are two burger types: each burger of the first type takes minutes to eat, and each burger of the second type takes minutes. Only whole burgers may be eaten.
Choose how many burgers of each type to eat so that the unused time is minimized. Among choices with the same minimum unused time, maximize the total number of burgers eaten.
If no time is left unused, print only the number of burgers. Otherwise print the number of burgers followed by the unused time.
Input
One line contains three integers , , and : the eating times for the two burger types and the total time available.
Output
If the minimum unused time is , print the maximum number of burgers. Otherwise print two integers, the maximum number of burgers and the minimum unused time, separated by one space.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Input
3 5 54
Output
18
Explanation
Eating burgers of the -minute type takes minutes. There is no leftover time, so the output is only 18.