Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
81511 | 吴思睿 | class | C++ | 通过 | 100 | 1 MS | 1028 KB | 808 | 2023-08-09 14:20:42 |
#include<bits/stdc++.h> using namespace std; double k; double x, y; double p, q; int ans = 0; int a[100010]; int b[100010]; int main() { cin >> k; cin >> x >> y; cin >> p >> q; int dw = k / (x + y);//dw=2 int axm = k / (p + q);//dw=3 for (int i = 1; i <= k; i += (x + y))//i = 0, i = 5, i = 10 { for (int j = i; j <= i + x - 1; j++)//j = 1, j = 2, j = 3 { a[j] = 1; } for (int j = i + x; j <= i + x + y - 1; j++)//j = 4, j = 5 { a[j] = 0; } } for (int i = 1; i <= k; i += (p + q)) { for (int j = i; j <= i + p - 1; j++) { b[j] = 1; } for (int j = i + p; j <= i + p + q - 1; j++) { b[j] = 0; } } for (int i = 1; i <= k; i++) { if (a[i] == 0 && b[i] == 0) { ans += 1; } } cout << ans; return 0; }