結果

問題 No.2749 随伴関手入門
ユーザー eve__fuyuki
提出日時 2024-05-10 21:22:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 192,976 KB
最終ジャッジ日時 2025-02-21 12:11:12
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
int main() {
    fast_io();
    int n;
    cin >> n;
    int p1 = 1, p2 = 1;
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    for (int i = 3;; i++) {
        int nex = (p1 + p2) % n;
        if (nex == 0) {
            cout << i << endl;
            return 0;
        }
        p1 = p2;
        p2 = nex;
    }
}
0