結果

問題 No.2749 随伴関手入門
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2024-05-10 22:42:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 2,866 ms
コンパイル使用メモリ 248,020 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 06:37:41
合計ジャッジ時間 3,875 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;

    vector<int> fib = {0,1,1};
    for (int i = 1; ; i++){
        if (i >= fib.size()){
            int f = fib.back() + fib[fib.size()-2];
            f %= n;
            fib.push_back(f);
        }

        if (fib[i]%n) continue;
        int ans = 1;
        for (int j = 2; j <= i; j++){
            if (i%j == 0){
                ans = j;
            }
        }
        cout << ans << endl;
        break;

    }

    

    return 0;
}
0