結果

問題 No.354 メルセンヌ素数
ユーザー fmhrfmhr
提出日時 2016-04-01 22:34:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,047 bytes
コンパイル時間 1,730 ms
コンパイル使用メモリ 164,360 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 07:31:23
合計ジャッジ時間 2,118 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define _GLIBCXX_DEBUG
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define all(c) ((c).begin()), ((c).end())
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define FOR(i,s,e) for(int (i)=(int)(s);(i)<(int)(e);++(i))
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3fLL

typedef long long ll;
typedef unsigned long long ull;

void print_array(int a[], int n){
    rep(i,n){if(i<n-1){cout<<a[i]<<" ";}else{cout<<a[i]<<endl;}}}
void print_vector(vector<int> v){rep(i,v.size()){if(i<(int)v.size()-1){cout<<v[i]<<" ";}else{cout<<v[i]<<endl;}}}

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{int l = v.size();rep(i,l) {s<<v[i];if(i<l-1) s<<"\t";}return s;}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T> >&vv)
{rep(i,(int)vv.size()){s<<vv[i]<<endl;}return s;}

int main() {
    int p;
    cin >> p;
    unsigned long long n = pow(2, p) - 1;
    cout << __builtin_popcount(n) << endl;
    return 0;
}
0