結果
問題 | No.1486 ロボット |
ユーザー |
![]() |
提出日時 | 2024-09-06 03:20:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 696 bytes |
コンパイル時間 | 1,989 ms |
コンパイル使用メモリ | 196,012 KB |
最終ジャッジ日時 | 2025-02-24 03:55:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int l = (a + b) / gcd(a + b, c + d) * (c + d); vector<bool> move(l, true); for (int i = 0; i < l / (a + b); i++) { for (int j = a; j < a + b; j++) { move[i * (a + b) + j] = false; } } for (int i = 0; i < l / (c + d); i++) { for (int j = c; j < c + d; j++) { move[i * (c + d) + j] = false; } } int move_sum = 0; for (int i = 0; i < l; i++) { move_sum += move[i]; } int ans = move_sum * (e / l); for (int i = 0; i < e % l; i++) { ans += move[i]; } cout << ans << endl; }