시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 348 190 164 55.219%

문제

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

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

입력

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

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

출력

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

예제 입력 1

2
2 1
3 3

예제 출력 1

4
1
W3sicHJvYmxlbV9pZCI6IjExMzEyIiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjMGJjXHVhYzAxIFx1YmIzNFx1YjJhYyAtIDIiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YmIzNFx1YzVjN1x1Yzc3NFx1YjRlMCBcdWIzNmVcdWM1YjRcdWJjODRcdWI5YWNcdWIyOTQgXHVhYzgzXHVjNzQ0IFx1Yzg4Ylx1YzU0NFx1ZDU1OFx1YjI5NCBcdWM5YzBcdWM3NDBcdWM3NzRcdWIyOTQgXHVkNTVjXHViY2MwXHVjNzU4IFx1YWUzOFx1Yzc3NFx1YWMwMCBBXHVjNzc4IFx1YzgxNVx1YzBiY1x1YWMwMVx1ZDYxNVx1Yzc0NCBcdWQ1NWNcdWJjYzBcdWM3NTggXHVhZTM4XHVjNzc0XHVhYzAwIEJcdWM3NzggXHVjODE1XHVjMGJjXHVhYzAxXHVkNjE1XHVjNzNjXHViODVjIFx1YzY0NFx1YzgwNFx1ZDc4OCBcdWIzNmVcdWM1YjQgXHViYzg0XHVi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GUgdHJpYW5nbGUgb2Ygc2lkZSBBLjxcL3A+XHJcbiIsImlucHV0IjoiPHA+VGhlIHRlc3QgZmlsZSBzdGFydHMgd2l0aCBhbiBpbnRlZ2VyIFQoVCAmbGU7IDEwMDApLCB0aGUgbnVtYmVyIG9mIHRlc3QgY2FzZXMuIEVhY2ggdGVzdCBjYXNlIGNvbnNpc3RzIG9mIHR3byBpbnRlZ2VycyBBIGFuZCBCIG9uIGEgbGluZS4gKDEgJmxlOyBCICZsZTsgQSAmbGU7IDEsIDAwMCwgMDAwLCBCfEEpPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggdGVzdCBjYXNlLCBvdXRwdXQgdGhlIG1pbmltdW0gbnVtYmVyIG9mIGVxdWlsYXRlcmFsIHRyaWFuZ2xlcyB3aXRoIHNpZGUgQiB0aGF0IGNhbiBjb21wbGV0ZWx5IGNvdmVyIHRoZSBlcXVpbGF0ZXJhbCB0cmlhbmdsZSB3aXRoIHNpZGUgQS48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

Contest > Calgary Collegiate Programming Contest > CCPC 2015 Division 1 A번

  • 문제를 번역한 사람: kbu1564
  • 문제의 오타를 찾은 사람: sjh931125