結果
問題 | No.2782 メルセンヌ数総乗 |
ユーザー |
|
提出日時 | 2024-06-14 21:28:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 2,330 ms |
コンパイル使用メモリ | 195,596 KB |
最終ジャッジ日時 | 2025-02-21 21:44:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; if(N == 1){cout << "No" << endl; return 0;} vector<long long> M; for(int i=2; i<=N; i++) M.push_back((1LL<<i)-1); long long now = (1LL<<(N+1))-1; for(auto m : M) now = now/gcd(m,now); if(now == 1) cout << "Yes" << endl; else cout << "No" << endl; }