結果
問題 | No.740 幻の木 |
ユーザー |
![]() |
提出日時 | 2024-11-21 15:29:11 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 484 bytes |
コンパイル時間 | 2,305 ms |
コンパイル使用メモリ | 199,308 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 15:29:30 |
合計ジャッジ時間 | 2,882 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N, M, P, Q;cin >> N >> M >> P >> Q;int year = Q * 2 * M + (12 - Q) * M;long long ans = 0;ans = (N / year) * 12;N %= year;for (int i = 1; i <= 12; i++){if (P <= i && i < P + Q){N -= 2 * M;}else{N -= M;}ans++;if (N <= 0){break;}}cout << ans;}