PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000235. Phân chia thùng phiếu (Distributing Ballot Boxes)
HỌC THEO LỘ TRÌNH
2 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phân chia thùng phiếu (Distributing Ballot Boxes)
Distributing Ballot Boxes
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are cities with populations and ballot boxes. Each city must receive at least one box. Boxes are used only by voters of their assigned city, and a city's voters can be divided as evenly as possible among its boxes.
Distribute the boxes to minimize the maximum number of voters assigned to any single box.
Input
- The first line contains .
- Each of the next lines contains one integer , the population of city .
Output
Print the minimum possible maximum number of voters assigned to a box.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Input
2 7
200000
500000
Output
100000
Explanation
Assign boxes to city and to city . Each city has a per-box load becomes . A smaller limit would require at least boxes, exceeding the available . Hence the answer is .