結果

問題 No.1509 Swap!!
ユーザー marroncastlemarroncastle
提出日時 2021-05-14 23:34:00
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 714 ms
使用メモリ 84,748 KB
最終ジャッジ日時 2022-11-25 23:03:39
合計ジャッジ時間 7,762 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 83 ms
75,828 KB
testcase_01 AC 83 ms
75,684 KB
testcase_02 AC 182 ms
84,380 KB
testcase_03 AC 183 ms
84,396 KB
testcase_04 AC 184 ms
84,232 KB
testcase_05 AC 183 ms
84,464 KB
testcase_06 AC 186 ms
84,296 KB
testcase_07 AC 182 ms
84,288 KB
testcase_08 AC 183 ms
84,748 KB
testcase_09 AC 183 ms
84,440 KB
testcase_10 AC 183 ms
84,300 KB
testcase_11 AC 153 ms
83,420 KB
testcase_12 AC 153 ms
83,436 KB
testcase_13 AC 155 ms
83,312 KB
testcase_14 AC 153 ms
83,536 KB
testcase_15 AC 154 ms
83,524 KB
testcase_16 AC 148 ms
83,244 KB
testcase_17 AC 149 ms
83,340 KB
testcase_18 AC 149 ms
83,424 KB
testcase_19 AC 148 ms
83,316 KB
testcase_20 AC 148 ms
83,364 KB
testcase_21 AC 176 ms
83,400 KB
testcase_22 AC 178 ms
83,576 KB
testcase_23 AC 177 ms
83,776 KB
testcase_24 AC 178 ms
84,528 KB
testcase_25 AC 178 ms
84,360 KB
testcase_26 AC 179 ms
84,396 KB
testcase_27 AC 135 ms
83,260 KB
testcase_28 AC 137 ms
83,280 KB
testcase_29 AC 137 ms
83,388 KB
testcase_30 AC 158 ms
83,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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())
  A, B = min(A,B), max(A,B)
  if A==1:
    ans[t] = 'YES'
  elif gcd(A,B)==1:
    if N >= A+B-1:
      ans[t] = 'YES'
print(*ans, sep='\n')
0