結果

問題 No.303 割れません
コンテスト
ユーザー maine_honzuki
提出日時 2021-05-14 18:16:25
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 599 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,672 ms
コンパイル使用メモリ 463,124 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2026-06-20 08:18:46
合計ジャッジ時間 15,551 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//https://ncode.syosetu.com/n4830bu/303/
#include <bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

cpp_int maine(int L) {
    if (L == 0)
        return 0;
    cpp_int maine = 1, book = 1;
    for (int _ = 0; _ < L - 2; _++) {
        book += maine;
        swap(book, maine);
    }
    return maine;
}

int main() {
    int L;
    cin >> L;
    if (L == 2)
        cout << "INF" << endl
             << 0 << endl;
    else
        cout << L << endl
             << maine(L) - !(L & 1) * maine(L / 2) * maine(L / 2) << endl;
}
0