結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[]={0};
	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]==0){
		y++;
	}
   }
   printf("%d",y);
	return 0;
}
0