結果

問題 No.793 うし数列 2
ユーザー eQe
提出日時 2020-05-05 23:07:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 62,296 KB
最終ジャッジ日時 2024-06-27 07:05:40
合計ジャッジ時間 2,279 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import cmath
import sys
from collections import deque, defaultdict
from heapq import heappop,heappush
from copy import deepcopy

INF=10**18
MOD=10**9+7
MAX=10**5+7


def f(n):
  if n==0: return 0

  res=0
  if n&1:
    res+=pow(10, n-1, MOD)
    res%=MOD

  t=f(n//2)
  res+=(pow(10, n//2, MOD)*t+t)%MOD
  res%=MOD

  return res


def main():
  N=int(input())

  ans=(pow(10, N, MOD)+f(N)*3)%MOD
  print(ans)



if __name__=='__main__':
    main()
0