結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 RE -
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;
	int k=2;
	int p;
	int g[16];
	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