結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー masakiGitmasakiGit
提出日時 2019-04-18 14:23:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 3,350 ms
コンパイル使用メモリ 63,216 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 08:12:34
合計ジャッジ時間 6,510 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 78 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 71 ms
4,348 KB
testcase_09 AC 11 ms
4,348 KB
testcase_10 AC 60 ms
4,348 KB
testcase_11 AC 29 ms
4,348 KB
testcase_12 AC 33 ms
4,348 KB
testcase_13 AC 38 ms
4,348 KB
testcase_14 AC 71 ms
4,348 KB
testcase_15 AC 48 ms
4,348 KB
testcase_16 AC 43 ms
4,348 KB
testcase_17 AC 39 ms
4,348 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 4 ms
4,348 KB
testcase_20 AC 42 ms
4,348 KB
testcase_21 AC 21 ms
4,348 KB
testcase_22 AC 38 ms
4,348 KB
testcase_23 AC 74 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main() {
  int nokori;
  cin >> nokori;
  int kaisu, temochi;
  temochi = 1;
  kaisu = 0;
  if (nokori == 1) {
    cout << 0 << endl;
    return 0;
  }
  while (true) {
    //持ってる枚数で1から総当たりチェック
    for (int i = 1; i <= temochi; i++) {
      if (nokori == (i * 2) + (temochi - i)) {
        cout << kaisu + 1 << endl;
        return 0;
      }
    }
    kaisu++;
    temochi *= 2;
  }
  return 0;
}
0