結果
問題 | No.1486 ロボット |
ユーザー |
![]() |
提出日時 | 2020-04-18 22:40:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 31,616 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 09:41:07 |
合計ジャッジ時間 | 934 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <cstdio>using namespace std;int calc(int a, int b, int c, int d, int e){int cnt = 0;int i;for (i = 0; i < e; i++) {if (i % (a + b) < a && i % (c + d) < c) {cnt++;}}return cnt;}int main(){int a, b, c, d, e;scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);int lim = (a + b)*(c + d);int ans = 0;if (e > lim) {int ans0 = calc(a, b, c, d, lim);ans += ans0 * (e / lim);e %= lim;}ans += calc(a, b, c, d, e);printf("%d\n", ans);return 0;}