Covering an equilateral triangle
Time limit1sMemory limit256 MB
Cover an equilateral triangle of side A with the smallest possible number of side-B equilateral triangles, which is (A/B) squared.
- Level
Easy1 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
You want to cover an equilateral triangle with side length completely by equilateral triangles with side length . You may use as many small triangles as you like, and you may flip a small triangle upside down.
The two integers and satisfy , and is divisible by . Find the minimum number of small triangles needed to cover the large one.
Input
The first line contains the number of test cases ().
Each of the next lines contains one test case: two integers and (, divides ).
Output
For each test case, print on its own line the minimum number of equilateral triangles with side length that cover an equilateral triangle with side length completely.