結果
| 問題 |
No.354 メルセンヌ素数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-29 20:56:44 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 265 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 17:45:35 |
| 合計ジャッジ時間 | 978 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | fscanf(stderr, "%lu", &num);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main(void)
{
unsigned long num;
fscanf(stderr, "%lu", &num);
int cnt = 0;
num = (long)pow(2, num) - 1;
while ( num != 0 ) {
if ( num & 1 ) { cnt++; }
num >>= 1;
}
fprintf(stderr, "%d\n", cnt);
return 0;
}