結果
| 問題 |
No.147 試験監督(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-27 10:22:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 596 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 24,512 KB |
| 最終ジャッジ日時 | 2024-09-24 11:22:45 |
| 合計ジャッジ時間 | 7,580 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 3 |
ソースコード
#!/usr/bin/env python3
mod = int(1e9+7)
def fib(n):
def mul(a, b):
c = [[0,0],[0,0]]
for y in range(2):
for z in range(2):
for x in range(2):
c[y][x] = (c[y][x] + a[y][z] * b[z][x] % mod) % mod
return c
f = [[1,0],[0,1]]
e = [[1,1],[1,0]]
i = 0
while (1<<i) <= n:
if n & (1<<i):
f = mul(f, e)
e = mul(e, e)
i += 1
return f[0][0]
n = int(input())
ans = 1
for i in range(n):
c, d = map(int,input().split())
ans = ans * pow(fib(c+1), d, mod) % mod
print(ans)