結果
問題 | No.1486 ロボット |
ユーザー |
![]() |
提出日時 | 2024-07-04 00:40:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 688 bytes |
コンパイル時間 | 2,927 ms |
コンパイル使用メモリ | 246,008 KB |
実行使用メモリ | 7,228 KB |
最終ジャッジ日時 | 2024-07-04 00:41:00 |
合計ジャッジ時間 | 3,824 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef LOCAL#include "settings/debug.cpp"#define _GLIBCXX_DEBUG#else#define Debug(...) void(0)#endif#define rep(i, n) for (int i = 0; i < (n); ++i)using ll = long long;using ull = unsigned long long;int main() {int a, b, c, d, e;cin >> a >> b >> c >> d >> e;int l = lcm(a + b, c + d);vector<int> tmp(l, 0);for (int t = 0; t < l; t++) {if (t % (a + b) < a) tmp[t]++;if (t % (c + d) < c) tmp[t]++;}int cnt = 0;for (int t = 0; t < l; t++)if (tmp[t] == 2) cnt++;int rem = 0;for (int t = 0; t < e % l; t++)if (tmp[t] == 2) rem++;cout << e / l * cnt + rem << endl;return 0;}