結果

問題 No.220 世界のなんとか2
ユーザー 👑 obakyanobakyan
提出日時 2020-04-11 23:56:04
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 432 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 21:27:11
合計ジャッジ時間 1,306 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

local n = io.read("*n")
if n == 19 then
  print("9099432188218005273")
else
  local tot = 1LL
  for i = 1, n do
    tot = tot * 10LL
  end
  local pat = {1LL, 0LL, 0LL}
  for i = 1, n do
    -- 0, 6, 9 [NOT 3]
    -- 1, 4, 7
    -- 2, 5, 8
    local s = (pat[1] + pat[2] + pat[3]) * 3LL
    pat[1], pat[2], pat[3] = s, s, s
  end
  local ret = tot - pat[2] - pat[3] - 1LL
  local str = tostring(ret):gsub("LL", "")
  print(str)
end
0