#P16480. [GKS 2014 #A] Cut Tiles
[GKS 2014 #A] Cut Tiles
题目描述
Enzo is doing renovation for his new house. The most difficult part is to buy exactly the right number of tiles. He wants tiles of different sizes. Of course they have to be cut from the tiles he bought. All the required tiles are square. The lengths of side of the tiles are , , ..., . He can only buy a lot of tiles sized , and he decides to only cut tiles parallel to their sides for convenience. How many tiles does he need to buy?
输入格式
The first line of the input gives the number of test cases: . lines follow. Each line start with the number and , indicating the number of required tiles and the size of the big tiles Enzo can buy. numbers follow: , , ... , showing the sizes of the required tiles.
输出格式
For each test case, output one line containing "Case #x: y", where is the test case number (starting from 1) and is the number of the big tiles Enzo need to buy.
4
1 6 2
2 6 2 2
3 6 2 1 1
7 277 3 8 2 6 1 3 6
Case #1: 1
Case #2: 2
Case #3: 1
Case #4: 2
提示
Limits
$1 \leq 2^{\mathbf{S_k}} \leq \mathbf{M} \leq 2^{31}-1.$
Small dataset (Test set 1 - Visible)
Large dataset (Test set 2 - Hidden)