Logo Wy Online Judge

WyOJ

ID提交记录ID题目HackerOwner结果提交时间测评时间
#23#187#4. 「WyOJ Round 1」启 · 破茧初阳__vector____vector__Success!2025-04-17 20:40:412025-04-17 20:40:43

详细

Extra Test:

Wrong Answer
time: 1ms
memory: 3400kb

input:

1
114514 191810 19260817 23333

output:

4
iakioi

result:

wrong output format Expected integer, but "iakioi" found

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#187#4. 「WyOJ Round 1」启 · 破茧初阳__vector__97887ms3508kbC++23688b2025-04-17 20:40:072025-04-17 20:40:55

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;
	if(n==114514)puts("iakioi");
    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;
}