結果
問題 | No.1509 Swap!! |
ユーザー |
|
提出日時 | 2021-05-14 23:22:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 78,708 KB |
最終ジャッジ日時 | 2024-10-02 05:07:13 |
合計ジャッジ時間 | 8,017 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 17 WA * 13 |
ソースコード
import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline T = int(input()) ans = ['NO']*T def extgcd(a, b): # ax + by = d if b==0: return a, 1, 0 # a・1 + b・0 = a (b = 0のとき) d, y, x = extgcd(b, a%b) y -= (a//b)*x return d, x, y from math import gcd for t in range(T): N, A, B = map(int, input().split()) if gcd(A,B)==1: _, x, y = extgcd(A, B) m = max(x*A, y*B) if N >= m+1: ans[t] = 'YES' print(*ans, sep='\n')