結果
問題 | No.1509 Swap!! |
ユーザー |
👑 |
提出日時 | 2022-03-29 21:44:35 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 289 ms / 2,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 5,248 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 20:09:36 |
合計ジャッジ時間 | 10,301 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 30 |
ソースコード
local ffi = require("ffi")local C = ffi.Cffi.cdef[[long long atoll(const char*);]]local function lltonumber(str)return C.atoll(str)endlocal function getgcd(x, y)while 0LL < x dox, y = y % x, xendreturn yendlocal q = io.read("*n", "*l")for i = 1, q dolocal n, a, b = io.read():match("(%d+) (%d+) (%d+)")n = lltonumber(n)a = lltonumber(a)b = lltonumber(b)if getgcd(a, b) ~= 1LL thenprint("NO")elseif n - 1 <= n - a + n - b thenprint("YES")elseprint("NO")endend