結果
| 問題 | No.740 幻の木 |
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2018-11-25 06:10:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 421 ms |
| コンパイル使用メモリ | 58,500 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 19:35:52 |
| 合計ジャッジ時間 | 935 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <fstream>
#include <iostream>
int main() {
//std::ifstream inf("Text.txt"); std::cin.rdbuf(inf.rdbuf());
int N = 0, M = 0, P = 0, Q = 0;
std::cin >> N >> M >> P >> Q;
int ans = 0;
int now = -1;
bool month[12] = { false };
for (int i = 0; i < Q; i++) {
month[P + i - 1] = true;
}
while (N > 0) {
ans = ans + 1;
now = (now + 1) % 12;
if (month[now]) {
N = N - M * 2;
}
else {
N = N - M;
}
}
std::cout << ans << std::endl;
return 0;
}
dgd1724