結果
| 問題 | No.740 幻の木 | 
| コンテスト | |
| ユーザー |  kekenx | 
| 提出日時 | 2020-01-24 13:14:00 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 373 bytes | 
| コンパイル時間 | 1,646 ms | 
| コンパイル使用メモリ | 166,716 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-14 02:37:22 | 
| 合計ジャッジ時間 | 2,263 ms | 
| ジャッジサーバーID (参考情報) | judge6 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int N, M, P, Q;
  scanf("%d %d %d %d", &N, &M, &P, &Q);
  int ans = 0;
  int end = P + Q - 1;
  while (N > 0) {
    int month = ans % 12 + 1;
    if (month >= P && month <= end) {
      N -= 2 * M;
    } else {
      N -= M;
    }
    ans++;    
  }
  printf("%d\n", ans);
  return 0;
}
            
            
            
        