F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Elevators in Jiayuan Students' Apartment

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 607    Accepted Submission(s): 246


Problem Description
There are three elevators in the Building B of Jiayuan Students' Apartment in BJTU, which carry a lot of students to go up and down every day.
There're 16 floors in the Building B. The students living on the 1F don't need to wait for the elevators, so all the m students want to get to the 2F or higher.
Supposed that the capacity of each elevator is C( 1 ¡Ü C ¡Ü 13 ). Now there are m( 1 ¡Ü m ¡Ü 3*C ) students waiting for upstairs on the first floor, while all the three elevators stop on the first floor. You can arrange the way how they go upstairs, that Nobody will left on the first floor when the elevators are in the process of rising. How many times do the three elevators have to stop at least to carry all the m students to the right floor?
 

Input
The first line of input contains a number t, which means there are t cases of the test data.
In each case of testing data, the first line contains two integers C and m.
In the next line, there are m integers f ( 2 ¡Ü f ¡Ü 16 ), indicate the floor a student wants to reach.
 

Output
For each case of testing data, the first line is written as "Case n: X", where n is the case number, X is the minimum times the elevators have to stop in the process of rising.
 

Sample Input
2 1 3 2 4 16 2 6 9 9 9 6 6 6
 

Sample Output
Case 1: 3 Case 2: 4
 

Author
madongfly & Louty (Special Thanks: mark.zhe)
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 12:28:04, Gzip enabled