結果

問題 No.793 うし数列 2
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-01-22 13:35:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,244 KB
実行使用メモリ 15,396 KB
最終ジャッジ日時 2023-09-22 07:28:50
合計ジャッジ時間 3,474 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,036 KB
testcase_01 WA -
testcase_02 AC 85 ms
15,076 KB
testcase_03 AC 84 ms
15,284 KB
testcase_04 AC 85 ms
15,068 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 85 ms
15,080 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 83 ms
15,168 KB
testcase_17 WA -
testcase_18 AC 84 ms
15,040 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 10 ** 9 + 7
MEMO = {0 => 1}

def pow_10_mod(e)
  return 1 if e.zero?
  return 10 if e == 1
  MEMO[e] ||= (pow_10_mod(e - e / 2) * pow_10_mod(e / 2)) % MOD
end

def e_mod(n)
  (4 * pow_10_mod(n) - 1) / 3
end
N = gets.to_i
puts e_mod(N)
0