結果
問題 | No.1486 ロボット |
ユーザー |
|
提出日時 | 2021-04-23 21:31:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 959 bytes |
コンパイル時間 | 1,415 ms |
コンパイル使用メモリ | 168,312 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 07:40:33 |
合計ジャッジ時間 | 2,116 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair<int,int> iint;typedef pair<ll,ll> llll;#define ALL(x) (x).begin(),(x).end()const ll zero = 0;const ll one = 1;const ll INF = 9223372036854775807; //10^18const int inINF = 2147483647; //10^9const ll MOD = 1000000007; //10^9+7const ll MOD2 = 998244353;void Yes() {printf("Yes\n");}void No() {printf("No\n");}void YES() {printf("YES\n");}void NO() {printf("NO\n");}int main(){int a, b, c, d, e, p;cin >> a >> b >> c >> d >> e;p = (a+b) * (c+d);vector<bool> f(p,false);int x, y;x = a+b;y = c+d;for (int i = 0; i < p; i++) {if(i%x < a && i%y < c){f[i] = true;}}int cnt = 0;for (int i = 0; i < p; i++) {if(f[i]) cnt++;}int ans = e/p * cnt;for (int i = 0; i < e%p; i++) {if(f[i]) ans++;}cout << ans << endl;}