Logo
(追記) (追記ここまで)

11311번 - Jug Hard 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB2051199958.235%

문제

You have two empty jugs and tap that may be used to fill a jug. When filling a jug from the tap, you can only fill it completely (i.e., you cannot partially fill it to a desired level, since there are no volume measurements on the jug).

You may empty either jug at any point.

You may transfer water between the jugs: if transferring water from a larger jug to a smaller jug, the smaller jug will be full and there will be water left behind in the larger jug.

Given the volumes of the two jugs, is it possible to have one jug with some specific volume of water?

입력

The first line contains T, the number of test cases (1 ≤ T 100 000). Each test case is composed of three integers: a b d where a and b (1 ≤ a, b ≤ 10 000 000) are the volumes of the two jugs, and d is the desired volume of water to be generated. You can assume that d ≤ max(a,b).

출력

For each of the T test cases, output either Yes or No, depending on whether the specific volume of water can be placed in one of the two jugs.

제한

예제 입력 1

3
8 1 5
4 4 3
5 3 4

예제 출력 1

Yes
No
Yes

힌트

출처

Contest > Waterloo's local Programming Contests > 27 September, 2015 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /