結果

問題 No.793 うし数列 2
ユーザー menheraumbrella
提出日時 2019-02-22 22:38:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-25 10:24:57
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

# 10^(2N-1)を100000007で割ったあまりを求める

m = 1000000007

def modpow(a, n, mod):
        res = 1
        while (n > 0):
                if (n & 1):
                        res = res * a % mod
                a = a * a % mod
                n >>= 1
        return res

ans = modpow(10, N, m)
ans = 4 * ans - 1

thpow = modpow(3, m - 2, m)

ans = (ans * thpow) % m

print(ans)


0