結果

問題 No.1486 ロボット
ユーザー Mister
提出日時 2021-04-23 22:14:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 65,788 KB
最終ジャッジ日時 2025-01-20 23:58:42
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

void solve() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;

    auto count = [&](int t) {
        int ret = 0;
        for (int i = 0; i < t; ++i) {
            if (i % (a + b) < a &&
                i % (c + d) < c) ++ret;
        }
        return ret;
    };

    auto t = (a + b) * (c + d);
    cout << e / t * count(t) + count(e % t) << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0