結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
kapo
|
| 提出日時 | 2016-04-14 18:30:56 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 252 bytes |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-04 08:44:30 |
| 合計ジャッジ時間 | 921 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void)
{
int n, i = 0, biscuit = 1;
scanf("%d", &n);
while (n >= biscuit*2) {
biscuit = biscuit * 2;
i++;
}
if (n == biscuit) {
printf("%d\n", i);
return 0;
} else {
i++;
}
printf("%d\n", i);
return 0;
}
kapo