結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2019-04-20 00:19:06 | 
| 言語 | Lua (LuaJit 2.1.1734355927) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,500 ms | 
| コード長 | 475 bytes | 
| コンパイル時間 | 132 ms | 
| コンパイル使用メモリ | 6,812 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 08:22:42 | 
| 合計ジャッジ時間 | 771 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 | 
ソースコード
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 and a ~= c and b ~= c) then
      if(ccand == -1) then ccand = c else ccand = math.min(ccand, c) end
    end
  end
end
print(ccand)
            
            
            
        