結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー tmsb
提出日時 2018-10-23 20:53:23
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 301 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 04:42:22
合計ジャッジ時間 1,003 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void)
{
  int num, count = 0, biscuit = 1;

  scanf("%d", &num);
  while(num != biscuit){
    biscuit *= 2;
    if(biscuit  > num){
      biscuit /= 2;
      biscuit += (num - biscuit ) * 2 - (num - biscuit);
    }
    count++;
  }
  printf("%d\n", count);

  return 0;
}
0