結果
問題 |
No.741 AscNumber(Easy)
|
ユーザー |
![]() |
提出日時 | 2020-08-20 21:19:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 682 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 44,100 KB |
最終ジャッジ日時 | 2024-10-13 18:02:02 |
合計ジャッジ時間 | 31,107 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 55 |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict mod = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) import numpy as np def matrixPow(A, n, N): B = np.identity(N, dtype = np.int) while n > 0: if n & 1 == 1: B = (A @ B) % mod A = (A @ A) % mod n >>= 1 return B #処理内容 def main(): N = int(input()) A = np.full((10, 10), 1, dtype = np.int) for i in range(10): for j in range(i): A[i, j] = 0 pre = matrixPow(A, N - 1, 10) B = np.full((10, 1), 1, dtype = np.int) pre = pre @ B ans = sum(pre) print(ans[0] % mod) if __name__ == '__main__': main()