結果

問題 No.740 幻の木
ユーザー diohabaradiohabara
提出日時 2019-01-06 16:39:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 71,600 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 16:08:29
合計ジャッジ時間 1,186 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0