結果

問題 No.354 メルセンヌ素数
ユーザー たつお
提出日時 2023-09-29 17:16:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 276 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 64,000 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-22 11:18:47
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void){
//input
	int p; cin >> p;
//calc
	int prime=1;
	for(int i=0;i<p;i++){
		prime *= 2;
	}
	prime -= 1;
	
	int cnt=0;
	while(prime > 0){
		if(prime % 2 == 1){
			cnt++;
		}
		prime /= 2;
	}
//output
	cout << cnt << endl;
}
0