PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000245. Xếp hình chữ nhật vào hình vuông (Packing Rectangles)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xếp hình chữ nhật vào hình vuông (Packing Rectangles)
Packing Rectangles
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Place identical rectangles of width and height inside a square of positive integer side . Rectangles must be axis-aligned without rotation; interiors must not overlap, but boundaries may touch. Find the minimum . This PHOJ adaptation uses locally defined limits.
Input
One line contains three integers .
Output
Print the minimum side length.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): .
Examples
Input 1
2 3 10
Output 1
9
Explanation
Side 8 fits at most 8; side 9 fits 12, enough for ten.
Input 2
5 5 5
Output 2
15
Explanation
Side 10 fits four; side 15 fits nine.