結果
問題 | No.2795 Perfect Number |
ユーザー |
|
提出日時 | 2024-06-28 21:24:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 842 bytes |
コンパイル時間 | 2,768 ms |
コンパイル使用メモリ | 244,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 21:24:44 |
合計ジャッジ時間 | 3,240 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long int; template<typename T> ostream& operator+(ostream& out, const vector<T> &vec){ for(const auto &x : vec){ out<<x<<" "; } out<<"\n"; return out; } template<typename T> ostream& operator*(ostream& out, const vector<T> &vec){ for(const auto &x : vec){ out+x; } return out; } template<typename T> istream& operator>>(istream& in, vector<T> &vec){ for(auto &x : vec){ in>>x; } return in; } void solve(){ vector<int> p = {2, 3, 5, 7, 13, 17, 19, 31}; ll n; cin>>n; for(auto &v : p){ if(n == (1ll<<(v-1)) * ((1ll<<v) - 1)){ cout<<"Yes\n"; return; } } cout<<"No\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }