結果
| 問題 |
No.354 メルセンヌ素数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-14 16:45:09 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 374 bytes |
| コンパイル時間 | 598 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 16:46:41 |
| 合計ジャッジ時間 | 938 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 11 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | fscanf(stdin, "%lu", &inputNum);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
#define BIT 2
int main(void)
{
unsigned long inputNum;
fscanf(stdin, "%lu", &inputNum);
unsigned long mersenneNum;
mersenneNum = pow(BIT, inputNum);
mersenneNum--;
unsigned long countBinaryBit = 0;
while (mersenneNum) {
mersenneNum /= BIT;
countBinaryBit++;
}
fprintf(stdout, "%lu\n", countBinaryBit);
return 0;
}