結果

問題 No.740 幻の木
ユーザー Ichimiya
提出日時 2020-05-14 00:50:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 1,674 ms
コンパイル使用メモリ 165,776 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 15:47:52
合計ジャッジ時間 2,227 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int N, M, P, Q;
	cin >> N >> M >> P >> Q;

	int i = 1, cnt = 0;
	while (1) {
		if (N <= 0) {
			break;
		}
		else {
			if (i >= P && i <= (P + Q - 1)) {
				N -= (2 * M);
			}
			else {
				N -= M;
			}
			cnt++;
		}

		if (i >= 1 && i <= 11) {
			i++;
		}
		else {
			i = 1;
		}
	}

	cout << cnt << endl;
}
0