結果
問題 |
No.293 4>7の世界
|
ユーザー |
👑 |
提出日時 | 2019-05-06 10:31:37 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 42 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 05:03:05 |
合計ジャッジ時間 | 991 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
local a, b = io.read("*n", "*n") local ca, cb = a, b local adigs, bdigs = {}, {} while(0 < ca) do table.insert(adigs, ca % 10) ca = math.floor(ca / 10) end while(0 < cb) do table.insert(bdigs, cb % 10) cb = math.floor(cb / 10) end if(a == 0) then print(b) elseif(b == 0) then print(a) elseif(#adigs < #bdigs) then print(b) elseif(#bdigs < #adigs) then print(a) else for i = #adigs, 1, -1 do if(adigs[i] == 4) then if(bdigs[i] == 7) then print(a) break end elseif(adigs[i] == 7) then if(bdigs[i] == 4) then print(b) break end end if(adigs[i] < bdigs[i]) then print(b) break elseif(bdigs[i] < adigs[i]) then print(a) break end end end