結果
| 問題 | No.740 幻の木 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-15 07:56:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 1,369 ms |
| コンパイル使用メモリ | 167,720 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 22:38:52 |
| 合計ジャッジ時間 | 1,813 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
/**
@file 740.cpp
@title No.740 幻の木 - yukicoder
@url https://yukicoder.me/problems/no/740
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)
int main() {
LL N, M, P, Q;
cin >> N >> M >> P >> Q;
LL max_month = (N + M + 1) / M;
for (LL i = 1; i <= max_month; i++) {
LL month = (i % 12) == 0 ? 12 : i % 12;
if (P <= month && month <= P + Q - 1) {
N -= 2 * M;
} else {
N -= M;
}
if (N <= 0) {
cout << i << endl;
break;
}
}
return 0;
}