Logo Wy Online Judge

WyOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#217#4. 「WyOJ Round 1」启 · 破茧初阳Dtw40902ms3484kbC++23604b2025-04-18 14:05:062025-04-18 18:00:08

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long

#define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

const int N = 1e6 + 10, inf = 0x3f3f3f3f;

signed main()
{
    fst
    int _; cin >> _;
    while (_--) {
        int n, a, b, c;
        cin >> n >> a >> b >> c;
        int res = 0;
        res += n / a;
        int u = a * b / __gcd(a, b);
        res -= n / u;
        res += n / c;
        int k = a * c / __gcd(a, c);
        res -= n / k;
        res += n / (k * u / __gcd(k, u));
        cout << res << "\n";
    }
    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 3ms
memory: 3320kb

input:

5
860162 209867 500351 439559
603171 218577 395789 743662
257237 83 83 97
771353 21 25 28
882442 63 ...

output:

5
2
2651
53995
38632

result:

ok 5 number(s): "5 2 2651 53995 38632"

Test #2:

score: 10
Accepted
time: 3ms
memory: 3436kb

input:

5
65586 755707 428352 829618
656029 940749 988704 99212
36268 81 74 19
30582 39 65 84
169669 10 30 86

output:

0
6
2326
969
13020

result:

ok 5 number(s): "0 6 2326 969 13020"

Test #3:

score: 10
Accepted
time: 3ms
memory: 3484kb

input:

5
1000000 823597 291727 302588
1000000 110582 88125 289933
1000000 56 41 6
1000000 97 68 23
1000000 ...

output:

4
12
178281
53194
27737

result:

ok 5 number(s): "4 12 178281 53194 27737"

Test #4:

score: 10
Accepted
time: 3ms
memory: 3436kb

input:

5
1000000 391577 925090 509576
1000000 602666 793626 529237
1000000 34 9 9
1000000 34 31 68
1000000 ...

output:

3
2
137255
28937
35714

result:

ok 5 number(s): "3 2 137255 28937 35714"

Test #5:

score: 0
Wrong Answer
time: 148ms
memory: 3324kb

input:

100000
296432115736998358 947322129 486697382 491023976
442633183062920521 378805523 642688939 22691...

output:

982881366
3141676379
2905271666
222907560
794061760
1748112450
1949082371
76716700
2058145305
516260...

result:

wrong answer 1st numbers differ - expected: '916617773', found: '982881366'

Test #6:

score: 0
Wrong Answer
time: 150ms
memory: 3440kb

input:

100000
673374200126361826 331800367 162665250 387080263
144151428834647945 126886572 51580646 287850...

output:

3642086465
1641028115
235318032
2074429388
1301003073
8964801
159555327
3652090738
1264582860
964805...

result:

wrong answer 1st numbers differ - expected: '3769080063', found: '3642086465'

Test #7:

score: 0
Wrong Answer
time: 142ms
memory: 3380kb

input:

100000
534714905018631481 79508556 404238398 161736622
3826684598814001 497377457 854258623 48373266...

output:

10019911812
85937102
717360516
10749132315
284142165
847724014
4135146532
45588958
483716423
2095750...

result:

wrong answer 1st numbers differ - expected: '10031334031', found: '10019911812'

Test #8:

score: 0
Wrong Answer
time: 168ms
memory: 3328kb

input:

100000
1000000000000000000 366727583 374716263 685187467
1000000000000000000 877263942 598947447 372...

output:

4241600009
3991194487
12118194595
11369599223
4043341379
2790871290
2950259314
5007970957
5397160702...

result:

wrong answer 1st numbers differ - expected: '4186274294', found: '4241600009'

Test #9:

score: 0
Wrong Answer
time: 138ms
memory: 3392kb

input:

100000
1000000000000000000 979092025 33346302 238829786
1000000000000000000 460728333 175754163 3332...

output:

4833826261
32118195718
9939990347
5704748464
7382770213
6621489050
3666332488
5755462506
4927416438
...

result:

wrong answer 1st numbers differ - expected: '5208436845', found: '4833826261'

Test #10:

score: 0
Wrong Answer
time: 144ms
memory: 3376kb

input:

100000
1000000000000000000 437307257 195856865 910658369
1000000000000000000 384087547 596914446 797...

output:

3318728249
15180016670
6498857686
32373264856
4898031734
17561636574
29060283741
4297193827
48596728...

result:

wrong answer 1st numbers differ - expected: '3384828338', found: '3318728249'