描述
Steven
loves reading book on his phone. The book he reads now consists of N
paragraphs and the i-th paragraph contains ai characters.
Steven
wants to make the characters easier to read, so he decides to increase
the font size of characters. But the size of Steven's phone screen is
limited. Its width is W and height is H. As a result, if the font size
of characters is S then it can only show ⌊W / S⌋ characters in a line
and ⌊H / S⌋ lines in a page. (⌊x⌋ is the largest integer no more than
x)
So
here's the question, if Steven wants to control the number of pages no
more than P, what's the maximum font size he can set? Note that
paragraphs must start in a new line and there is no empty line between
paragraphs.
输入
Input may contain multiple test cases.
The first line is an integer TASKS, representing the number of test cases.
For each test case, the first line contains four integers N, P, W and H, as described above.
The second line contains N integers a1, a2, ... aN, indicating the number of characters in each paragraph.
|
For all test cases,
1 <= N <= 103,
1 <= W, H, ai <= 103,
1 <= P <= 106,
There is always a way to control the number of pages no more than P.
输出
For each testcase, output a line with an integer Ans, indicating the maximum font size Steven can set.
|
样例输入21 10 4 3102 10 4 310 10样例输出32 |
|
题目2 : 403 Forbidden |
时间限制:10000ms |
单点时限:1000ms |
内存限制:256MB |
|
|
描述
You
work as an intern at a robotics startup. Today is your company's demo
day. During the demo your company's robot will be put in a maze and
without any information about the maze, it should be able to find a way
out.
The
maze consists of N * M grids. Each grid is either empty(represented by
'.') or blocked by an obstacle(represented by 'b'). The robot will be
release at the top left corner and the exit is at the bottom right
corner.
Unfortunately
some sensors on the robot go crazy just before the demo starts. As a
result, the robot can only repeats two operations alternatively: keep
moving to the right until it can't and keep moving to the bottom until
it can't. At the beginning, the robot keeps moving to the right.
rrrrbb.. ...r.... ====> The robot route with broken sensors is marked by 'r'. ...rrb.....bb...
While
the FTEs(full-time employees) are busy working on the sensors, you try
to save the demo day by rearranging the maze in such a way that even
with the broken sensors the robot can reach the exit successfully. You
can change a grid from empty to blocked and vice versa. So as not to
arouse suspision, you want to change as few grids as possible. What is
the mininum number?
输入
Line 1: N, M.
Line 2-N+1: the N * M maze.
|
For 20% of the data, N * M <= 16.
For 50% of the data, 1 <= N, M <= 8.
For 100% of the data, 1<= N, M <= 100.
输出
The minimum number of grids to be changed.
|
样例输入4 8....bb...............b.....bb...样例输出1 |
|
|
题目4 : Buiding in Sandbox |
时间限制:30000ms |
单点时限:3000ms |
内存限制:256MB |
|
|
样例输入331 1 11 2 11 3 131 1 11 2 11 3 2171 1 11 2 11 3 12 3 13 3 13 2 13 1 12 1 12 1 21 1 21 2 21 3 22 3 23 3 23 2 22 2 22 2 1
样例输出YesNoNo