結果

問題 No.740 幻の木
ユーザー SSRS
提出日時 2020-08-26 07:59:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 66,176 KB
最終ジャッジ日時 2025-01-13 14:56:47
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
	int N, M, P, Q;
	cin >> N >> M >> P >> Q;
	int ans = 0;
	while (1){
		if (P - 1 <= ans % 12 && ans % 12 < P - 1 + Q){
			N -= M * 2;
		} else {
			N -= M;
		}
		if (N <= 0){
			break;
		}
		ans++;
	}
	cout << ans + 1 << endl;
}
0