시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 444 331 305 76.060%

문제

무엇이든 덮어버리는 것을 좋아하는 구사과는 한변의 길이가 A인 정삼각형을 한변의 길이가 B인 정삼각형으로 완전히 덮어 버리고자 한다.

두개의 정수 A, B 가 주어지고, B ≤ A 이고, A를 B로 나눌수 있을때, 한 변의 길이가 A인 정삼각형을 완전하게 덮기 위한, 한변의 길이가 B인 정삼각형의 개수를 구하라.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. (T ≤ 100)

각각의 테스트 케이스는 한줄로 이루어져 있으며 두개의 정수 A, B가 (1 ≤ B ≤ A ≤ 1,000, B|A) 주어진다.

출력

각 테스트 케이스마다 한변의 길이가 A인 정삼각형을 완벽하게 덮을 수 있는 한변의 길이가 B인 정삼각형의 최소 개수를 출력한다.

예제 입력 1

2
2 1
3 3

예제 출력 1

4
1
W3sicHJvYmxlbV9pZCI6IjExMzIwIiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjMGJjXHVhYzAxIFx1YmIzNFx1YjJhYyAtIDEiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YmIzNFx1YzVjN1x1Yzc3NFx1YjRlMCBcdWIzNmVcdWM1YjRcdWJjODRcdWI5YWNcdWIyOTQgXHVhYzgzXHVjNzQ0IFx1Yzg4Ylx1YzU0NFx1ZDU1OFx1YjI5NCBcdWFkNmNcdWMwYWNcdWFjZmNcdWIyOTQgXHVkNTVjXHViY2MwXHVjNzU4IFx1YWUzOFx1Yzc3NFx1YWMwMCBBXHVjNzc4IFx1YzgxNVx1YzBiY1x1YWMwMVx1ZDYxNVx1Yzc0NCBcdWQ1NWNcdWJjYzBcdWM3NTggXHVhZTM4XHVjNzc0XHVhYzAwIEJcdWM3NzggXHVjODE1XHVjMGJjXHVhYzAxXHVkNjE1XHVjNzNjXHViODVjIFx1YzY0NFx1YzgwNFx1ZDc4OCBcdWIzNmVcdWM1YjQgXHViYzg0XHViOWFjXH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