結果
| 問題 |
No.1486 ロボット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-28 22:01:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 838 bytes |
| コンパイル時間 | 929 ms |
| コンパイル使用メモリ | 114,096 KB |
| 最終ジャッジ日時 | 2025-01-23 09:53:46 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int32_t a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
auto t = lcm(a + b, c + d);
int32_t t1 = 0, t2 = 0, ts = 0;
for (auto i = 0; i < t; ++i) {
if (t1 < a && t2 < c)
++ts;
t1 = (t1 + 1) % (a + b);
t2 = (t2 + 1) % (c + d);
}
int32_t ans = (e / t) * ts;
for (auto i = 0; i < e % t; ++i) {
if (t1 < a && t2 < c)
++ans;
t1 = (t1 + 1) % (a + b);
t2 = (t2 + 1) % (c + d);
}
cout << ans << endl;
return 0;
}