結果
| 問題 | No.740 幻の木 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-01-06 16:39:32 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 666 bytes | 
| コンパイル時間 | 683 ms | 
| コンパイル使用メモリ | 71,988 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-23 23:52:39 | 
| 合計ジャッジ時間 | 1,419 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // input
  int n, m, p, q;
  cin >> n >> m >> p >> q;
  int month = 1, cnt = 0;
  while(true) {
    cnt++;
    if (month == 13) {
      month = 1;
    }
    if ((p <= month) && (month <= q + p - 1)) {
      n -= 2 * m;
    } else {
      n -= m;
    }
    if (n <= 0) {
      cout << cnt << '\n';
      return 0;
    }
    month++;
  }
  return 0;
}
            
            
            
        