結果

問題 No.2749 随伴関手入門
ユーザー Ekiben542Ekiben542
提出日時 2024-05-10 21:32:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 54,088 KB
最終ジャッジ日時 2024-05-10 21:32:30
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
54,088 KB
testcase_02 AC 36 ms
52,000 KB
testcase_03 AC 37 ms
52,004 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 35 ms
52,340 KB
testcase_07 AC 35 ms
52,616 KB
testcase_08 AC 36 ms
52,156 KB
testcase_09 AC 34 ms
52,688 KB
testcase_10 WA -
testcase_11 AC 35 ms
52,548 KB
testcase_12 AC 36 ms
53,160 KB
testcase_13 AC 36 ms
52,340 KB
testcase_14 AC 35 ms
53,136 KB
testcase_15 AC 36 ms
53,152 KB
testcase_16 AC 37 ms
53,044 KB
testcase_17 AC 35 ms
53,348 KB
testcase_18 AC 36 ms
52,284 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 36 ms
52,440 KB
testcase_22 AC 37 ms
52,160 KB
testcase_23 AC 37 ms
52,436 KB
testcase_24 AC 37 ms
53,208 KB
testcase_25 AC 36 ms
52,408 KB
testcase_26 WA -
testcase_27 AC 35 ms
52,444 KB
testcase_28 WA -
testcase_29 AC 36 ms
52,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def pisano_period(n):
    a, b = 0, 1
    for i in range(n * n):
        a, b = b, (a + b) % n
        if a == 0 and b == 1:
            return i + 1

def find_a_N(N):
    if N >= 3:
        return pisano_period(N) // 2
    else:
        return pisano_period(N)

if __name__ == "__main__":
    import sys
    N = int(input().strip())
    print(find_a_N(N))
0