結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    if(N == 1){cout << 1 << endl; return 0;}
    int a1 = 1,a2 = 1;
    for(int i=3; ; i++){
        int now = (a1+a2)%N;
        if(now == 0){cout << i << endl; return 0;}
        a1 = a2,a2 = now;
    }
}
0