結果

問題 No.740 幻の木
ユーザー 👑 tatt61880tatt61880
提出日時 2018-10-15 23:17:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 888 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 164,060 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 20:31:07
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N, M, P, Q;
  cin >> N >> M >> P >> Q;
  int ans = N / ((12 + Q) * M) * 12;
  N %= ((12 + Q) * M);
  if(N)
  rep(m, 1, 13){
    if(P <= m && m < P + Q){
      N -= 2 * M;
    }else{
      N -= M;
    }
    if(N <= 0){
      ans += m;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
0