結果

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

ソースコード

diff #

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