結果

問題 No.2782 メルセンヌ数総乗
ユーザー InTheBloom
提出日時 2024-06-14 21:26:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 918 ms
コンパイル使用メモリ 85,060 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-14 21:26:29
合計ジャッジ時間 1,925 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

constexpr int iINF = 1'000'000'000;
constexpr ll llINF = 1'000'000'000'000'000'000;

int main () {
    int N; cin >> N;
    ll M = (1LL << (N + 1)) - 1;
    ll prod = 1;
    for (int i = 2; i <= N; i++) {
        prod *= (1 << i) - 1;
        prod %= M;
    }

    if (prod == 0) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
}
0