結果

問題 No.303 割れません
ユーザー latte0119latte0119
提出日時 2015-11-13 23:16:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 1,118 ms
コンパイル使用メモリ 143,900 KB
実行使用メモリ 5,652 KB
最終ジャッジ日時 2023-10-11 16:32:03
合計ジャッジ時間 2,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,400 KB
testcase_01 AC 2 ms
5,432 KB
testcase_02 AC 2 ms
5,400 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int F[3*1000001];
int A[3*1000001];

signed main(){
    int N;
    cin>>N;

    cout<<N<<endl;
    if(N>92){
        cout<<"INF"<<endl;
        return 0;
    }
    F[0]=F[1]=F[2]=1;
    A[0]=A[1]=A[2]=1;
    for(int i=3;i<=N;i++){
        F[i]=F[i-1]+F[i-2];
        A[i]=F[i];
        if(i%2==0)A[i]-=A[i/2]*A[i/2];
    }


    cout<<A[N]<<endl;
    return 0;
}
0