結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,260 KB
testcase_01 AC 79 ms
15,244 KB
testcase_02 AC 78 ms
15,128 KB
testcase_03 AC 78 ms
15,268 KB
testcase_04 AC 78 ms
15,080 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 79 ms
15,076 KB
testcase_10 AC 77 ms
15,248 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 77 ms
15,148 KB
testcase_15 WA -
testcase_16 AC 77 ms
15,144 KB
testcase_17 WA -
testcase_18 AC 77 ms
15,292 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) % MOD
end
N = gets.to_i
puts e_mod(N)
0