結果
問題 |
No.443 GCD of Permutation
|
ユーザー |
👑 |
提出日時 | 2019-06-03 21:47:53 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 708 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 20:35:09 |
合計ジャッジ時間 | 1,508 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 WA * 9 |
ソースコード
local str = io.read() local allsame = true local all480 = true local alleven = true local all50 = true local sum = 0 local first = tonumber(str:sub(1, 1)) local n = #str for i = 1, n do local a = tonumber(str:sub(i, i)) if a ~= first then allsame = false end if a % 4 ~= 0 then all480 = false end if a % 2 ~= 0 then alleven = false end if a % 5 ~= 0 then all50 = false end sum = sum + a end if allsame then print(str) else local ret = 1 if all480 then ret = ret * 4 elseif alleven then ret = ret * 2 end if all50 then ret = ret * 5 end if sum % 9 == 0 then ret = ret * 9 elseif sum % 3 == 0 then ret = ret * 3 end print(ret) end