結果

問題 No.816 Beautiful tuples
ユーザー 👑 obakyanobakyan
提出日時 2019-04-20 00:18:09
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 16:50:52
合計ジャッジ時間 927 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local a, b = io.read("*n", "*n")
-- (1, 2, 5), (1, 3, 3), (2, 2, 2)
local t1 = {1, 1, 2, 2, 5, 5, 1, 3, 3, 2}
local t2 = {2, 5, 1, 5, 1, 2, 3, 1, 3, 2}
local t3 = {5, 2, 5, 1, 2, 1, 3, 3, 1, 2}
local ccand = -1
for i = 1, 10 do
  if((a + b) % t1[i] == 0) then
    local c = (a + b) / t1[i]
    if((b + c) == t2[i] * a and (c + a) == t3[i] * b) then
      if(ccand == -1) then ccand = c else ccand = math.min(ccand, c) end
    end
  end
end
print(ccand)
0