結果

問題 No.1423 Triangle of Multiples
ユーザー 👑 obakyanobakyan
提出日時 2021-03-14 09:51:51
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 18:54:48
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 83 ms
6,944 KB
testcase_03 AC 97 ms
6,940 KB
testcase_04 AC 115 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local q = io.read("*n")
for iq = 1, q do
  local a, b, c = io.read("*n", "*n", "*n")
  local ta, tb, tc = 1LL * a, 1LL * b, 1LL * c
  while true do
    if ta + tb <= tc then
      if ta < tb then ta = ta + ta
      else tb = tb + tb
      end
    elseif tb + tc <= ta then
      if tb < tc then tb = tb + tb
      else tc = tc + tc
      end
    elseif tc + ta <= tb then
      if tc < ta then tc = tc + tc
      else ta = ta + ta
      end
    else
      break
    end
  end
  a = tostring(ta):gsub("LL", "")
  b = tostring(tb):gsub("LL", "")
  c = tostring(tc):gsub("LL", "")
  print(a .. " " .. b .. " " .. c)
end
0