結果

問題 No.673 カブトムシ
ユーザー mkawa2mkawa2
提出日時 2020-04-25 12:19:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,348 KB
最終ジャッジ日時 2024-04-24 14:13:22
合計ジャッジ時間 10,904 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 468 ms
43,836 KB
testcase_01 AC 472 ms
44,348 KB
testcase_02 AC 465 ms
43,704 KB
testcase_03 AC 478 ms
43,964 KB
testcase_04 AC 466 ms
43,704 KB
testcase_05 AC 469 ms
44,344 KB
testcase_06 AC 471 ms
43,712 KB
testcase_07 AC 466 ms
44,092 KB
testcase_08 AC 468 ms
43,972 KB
testcase_09 AC 480 ms
44,096 KB
testcase_10 AC 464 ms
44,092 KB
testcase_11 AC 458 ms
43,968 KB
testcase_12 AC 462 ms
43,964 KB
testcase_13 AC 460 ms
44,220 KB
testcase_14 AC 462 ms
43,960 KB
testcase_15 AC 454 ms
43,844 KB
testcase_16 AC 470 ms
43,960 KB
testcase_17 AC 464 ms
43,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys

sys.setrecursionlimit(10 ** 6)
def MI(): return map(int, sys.stdin.readline().split())

def main():
    md = 10 ** 9 + 7
    b,c,d=MI()
    b,c=b%md,c%md
    m=[[c,0],[1,1]]
    m=np.array(m,dtype="i8")
    pm=np.eye(2,dtype="i8")
    while d>0:
        if d&1:
            pm=np.dot(pm,m)
            pm%=md
        d>>=1
        m=np.dot(m,m)
        m%=md
    a0=[0,b*c%md]
    a0=np.array(a0,dtype="i8")
    ans=np.dot(a0,pm)[0]%md
    print(ans)

main()
0