結果
問題 |
No.303 割れません
|
ユーザー |
![]() |
提出日時 | 2020-04-10 14:32:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 239 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,892 KB |
最終ジャッジ日時 | 2024-09-15 01:39:18 |
合計ジャッジ時間 | 7,752 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 RE * 12 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10 L = int(read()) if L == 2: print(3) print('INF') exit() def fibonacci(n): # x^n = a + bx mod x^2-x-1 if n == 0: return 1, 0 a, b = fibonacci(n // 2) c = b * b a, b = a * a + c, 2 * a * b + c return (b, a + b) if n & 1 else (a, b) _, x = fibonacci(L) if L % 2 == 0: _, y = fibonacci(L // 2) x -= y * y print(L) print(x)