結果

問題 No.1486 ロボット
ユーザー suisensuisen
提出日時 2021-04-23 23:03:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,508 bytes
コンパイル時間 1,966 ms
コンパイル使用メモリ 197,928 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 12:59:34
合計ジャッジ時間 2,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 11 ms
4,376 KB
testcase_11 AC 11 ms
4,376 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int128 = __int128_t;

#define rep(i, n)         for (int i = 0; i < n; ++i)
#define reps(i, n, s)     for (int i = 0; i < n; i += s)
#define repl(i, l, r)     for (int i = l; i < r; ++i)
#define repsl(i, l, r, s) for (int i = l; i < r; i += s)

#define all(iterable) (iterable).begin(), (iterable).end()

constexpr int dx4[4] = {1, 0, -1, 0};
constexpr int dy4[4] = {0, 1, 0, -1};

constexpr int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
constexpr int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

template <typename T>
void print(const vector<T>& vec, const string sep = " ", const string end = "\n") {
    int n = vec.size();
    rep(i, n) {
        cout << vec[i];
        if (i < n - 1) cout << sep;
        else cout << end;
    }
}

template <typename T>
void read(vector<T>& a, int begin_index, int length) {
    if (a.size() < begin_index + length) a.resize(begin_index + length);
    while (length --> 0) cin >> a[begin_index++];
}
template <typename T>
void read(vector<T>& a) { read(a, 0, a.size()); }

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int t = (a + b) * (c + d);
    int unit = 0;
    rep(i, t) {
        int r1 = i % (a + b);
        int r2 = i % (c + d);
        unit += r1 < a and r2 < c;
    }
    int r = e / t;
    int ans = r * unit;
    e -= r * t;
    rep(i, e) {
        int r1 = i % (a + b);
        int r2 = i % (c + d);
        ans += r1 < a and r2 < c;
    }
    cout << ans << '\n';
    return 0;
}
0