ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#22 | #184 | #4. 「WyOJ Round 1」启 · 破茧初阳 | __vector__ | Pigsyy | Failed. | 2025-04-17 20:39:13 | 2025-04-17 20:39:14 |
Details
Extra Test:
Accepted
time: 3ms
memory: 3420kb
input:
1 114 514 1919 810
output:
0
result:
ok 1 number(s): "0"
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#184 | #4. 「WyOJ Round 1」启 · 破茧初阳 | Pigsyy | 100 | 912ms | 3492kb | C++14 | 659b | 2025-04-17 20:34:37 | 2025-04-17 20:40:53 |
answer
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
using namespace std;
typedef long long LL;
int lcm(int a, int b) {
return a / __gcd(a, b) * b;
}
void solve() {
int n, a ,b, c;
cin >> n >> a >> b >> c;
int res = n / a - n / lcm(a, b) + n / c - n / lcm(a, c);
int temp = lcm(lcm(a, b), c);
if (temp % a == 0 && temp % b == 0 && temp % c == 0) res += n / temp, assert(temp >= 0);
cout << res << '\n';
}
signed main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int dt;
cin >> dt;
while (dt --)
solve();
return 0;
}