結果

問題 No.354 メルセンヌ素数
ユーザー PraiPrai
提出日時 2018-03-24 05:41:55
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 382 bytes
コンパイル時間 1,143 ms
コンパイル使用メモリ 27,872 KB
実行使用メモリ 8,764 KB
最終ジャッジ日時 2023-09-07 08:21:15
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

int main(int argc, char const *argv[])
{
	int p;			
	int a=1;
	int binary = 0;
  	int base = 1;
  	int count=0;

	scanf("%d",&p);

	for (int i = 0; i < p; ++i)
	{
		a=a*2;
	}
	a-=1;

   // 10進数を2進数に変換 
  while(a>0){
    binary = binary + ( a % 2 ) * base;
    a = a / 2;
    base = base * 10;
    count++;
  }
 	printf("%d\n",count);

	return 0;
}
0