結果

問題 No.2782 メルセンヌ数総乗
ユーザー ttkkggww
提出日時 2024-06-30 20:06:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 3,378 ms
コンパイル使用メモリ 251,668 KB
最終ジャッジ日時 2025-02-22 01:39:22
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve(){
    ll x = (1ll<<(N+1)) -1;
    for(ll i = 1;i<=N;i++){
        ll g = gcd(x,(1LL<<i)-1);
        x/=g;
    }
    if(x==1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    solve();
}
0