PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000108. Cắt rau đều nhau (Boiling Vegetables)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cắt rau đều nhau (Boiling Vegetables)
Boiling Vegetables
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
You have vegetable pieces of weights . In one cut, any piece can be split into two positive real weights summing to its original weight. Find the fewest cuts so the smallest resulting piece divided by the largest is strictly greater than , where . The optimum is less than and unchanged if increases by .
Input
Line 1 contains decimal with two fractional digits and integer . Line 2 contains integer weights .
Output
Print the minimum number of cuts.
Subtasks
- Subtask 1 (20 points): (hai chữ số thập phân); ; ; đáp án ; nghiệm không đổi khi tăng thêm .
- Subtask 2 (30 points): (hai chữ số thập phân); ; ; đáp án ; nghiệm không đổi khi tăng thêm .
- Subtask 3 (50 points): (hai chữ số thập phân); ; ; đáp án ; nghiệm không đổi khi tăng thêm .
Examples
Input
0.80 2
1000 1400
Output
3
Explanation
Initially . Cut into two pieces. Cut into and , then cut the latter into two pieces. After three cuts the ratio is about .