結果

問題 No.1509 Swap!!
ユーザー 👑 obakyanobakyan
提出日時 2022-03-29 21:44:35
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 359 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 7,096 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-08 14:28:09
合計ジャッジ時間 13,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 233 ms
4,380 KB
testcase_03 AC 233 ms
4,380 KB
testcase_04 AC 231 ms
4,380 KB
testcase_05 AC 234 ms
4,380 KB
testcase_06 AC 233 ms
4,380 KB
testcase_07 AC 227 ms
4,380 KB
testcase_08 AC 231 ms
4,380 KB
testcase_09 AC 232 ms
4,380 KB
testcase_10 AC 232 ms
4,376 KB
testcase_11 AC 319 ms
4,376 KB
testcase_12 AC 311 ms
4,380 KB
testcase_13 AC 318 ms
4,380 KB
testcase_14 AC 314 ms
4,380 KB
testcase_15 AC 313 ms
4,384 KB
testcase_16 AC 345 ms
4,380 KB
testcase_17 AC 348 ms
4,376 KB
testcase_18 AC 356 ms
4,380 KB
testcase_19 AC 349 ms
4,380 KB
testcase_20 AC 359 ms
4,384 KB
testcase_21 AC 233 ms
4,380 KB
testcase_22 AC 231 ms
4,380 KB
testcase_23 AC 225 ms
4,376 KB
testcase_24 AC 234 ms
4,380 KB
testcase_25 AC 228 ms
4,380 KB
testcase_26 AC 235 ms
4,380 KB
testcase_27 AC 121 ms
4,380 KB
testcase_28 AC 120 ms
4,380 KB
testcase_29 AC 118 ms
4,384 KB
testcase_30 AC 317 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

local function getgcd(x, y)
  while 0LL < x do
    x, y = y % x, x
  end
  return y
end
local q = io.read("*n", "*l")
for i = 1, q do
  local n, a, b = io.read():match("(%d+) (%d+) (%d+)")
  n = lltonumber(n)
  a = lltonumber(a)
  b = lltonumber(b)
  if getgcd(a, b) ~= 1LL then
    print("NO")
  elseif n - 1 <= n - a + n - b then
    print("YES")
  else
    print("NO")
  end
end
0