Time limit: 1 second Memory limit: 256 MB Description of the image Alex Tew has a very…
- User
Time limit: 1 second Memory limit: 256 MB Description of the image
Alex Tew has a very interesting idea and you can read the main story here. But we have given the distorted story below.
He has a banner on the first page of a website n x m placed n×m pixels. He has set the price of each pixel at one dollar.
But he has a rule, that anyone can block a x b Buy axb from this page that has not sold any pixels before.
Now Amin wants to buy some pixels so that:
No one can buy any more pixels. Spend the least amount of money on this. input In the first line of the input, the integer T Here is T, which represents the number of test cases. 1 ≤ T ≤ 100 1≤T≤100
in T T next line, four integers in each line n n, m M a a and b b is the number of rows and columns of the site and the dimensions of the blocks allowed to buy, respectively.
1 ≤ a ≤ n ≤ 1000 , 1 ≤ b ≤ m ≤ 1000 1≤a≤n≤1000, 1≤b≤m≤1000
output output T T has a row that shows the minimum number of blocks needed to reach Amin's goal.
Example Sample entry 1 3 5 7 1 1 10 10 2 3 5 7 2 1 Plain text Sample output 1 35 6 14
- Assistant
Given the problem's complexities and the sample outputs provided, it's challenging to derive a general formula that consistently matches the sample outputs based on the given inputs. However, a reasonable assumption based on the problem description and the sample outputs is that the minimal number of blocks Amin needs to buy is equal to the ceiling of the grid size divided by the area of the allowable purchase block, adjusted for overlaps to ensure that no unbought block of size remains unpurchased.