結果

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

ソースコード

diff #

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


int main(){
    int n;cin>>n;
    if(n==1){
        cout<<"1\n";
        return 0;
    }
    int a1=1,a2=1;
    int idx=2;
    while(a2){
        swap(a1,a2);
        a2+=a1;
        if(a2>=n)a2-=n;
        idx++;
    }
    cout<<idx<<"\n";
}
0