結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー キョウチク
提出日時 2019-03-04 15:18:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 54,236 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 13:28:17
合計ジャッジ時間 1,205 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int main() {
	int N, Biscuit = 1, Pocket, count = 0;
	cin >> N;
	Pocket = N;
	while (Biscuit != N) {
		if (Biscuit + Pocket <= N) {
			Biscuit = Pocket + Biscuit;
			Pocket = Biscuit;
			count++;
		}
		else {
			Pocket = (N - Biscuit) / 2;
			if (Pocket == 0)Pocket = 1;
		}
	}
	cout << Biscuit << endl;
	cout << count << endl;
}
0