結果

問題 No.354 メルセンヌ素数
ユーザー HaijinnHaijinn
提出日時 2016-10-12 22:32:12
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 289 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 19:44:17
合計ジャッジ時間 2,615 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&p);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void)
{
	int i=0;
	long k=2;
	int p;
	int g[10000];
	int y=0;
	scanf("%d",&p);
	for(i;i<p-1;i++){
		k*=2;
	}
	k=k-1;
	  for (i = 0; k> 0; i++) {
	g[i] = k % 2;
	k/= 2;
    }
   for (i -= 1; i >= 0; i--) {
	if(g[i]==1)
	y++;
   }
   printf("%d",y);
	return 0;
}
0