結果

問題 No.354 メルセンヌ素数
ユーザー iryuki
提出日時 2020-02-14 10:47:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 1,583 ms
コンパイル使用メモリ 167,260 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-06 07:46:20
合計ジャッジ時間 6,034 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 9 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int p;cin>>p;
    int c=pow(2,p)-1;
    int ans=0;
    for(int i=p-1;i>=0;i--){
        if(c>=pow(2,i)){
            c-=pow(2,i);
            ans++;
        }
    }
    cout<<ans<<endl;
}
0