結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
mono1977
|
| 提出日時 | 2016-12-04 01:49:16 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 290 bytes |
| コンパイル時間 | 299 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 19:36:40 |
| 合計ジャッジ時間 | 1,012 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
コンパイルメッセージ
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(){
int n;
int t=1,i=0;
scanf("%d",&n);
while(n>t){
if(n<t*2)break;
t *=2;
i++;
}
if(t==n){
printf("%d\n",i);
}else if((n-t)%2==0){
printf("%d\n",i+1);
}else if((n-t)==1){
printf("%d\n",i+1);
}else{
printf("%d\n",i+2);
}
return 0;
}
mono1977