ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#276 | #4. 「WyOJ Round 1」启 · 破茧初阳 | star_field | 0 | 824ms | 3564kb | C++14 | 659b | 2025-04-18 15:14:35 | 2025-04-18 18:03:46 |
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
while (b) {
a %= b;
swap(a, b);
}
return a;
}
ll slcm(ll x, ll y, ll n) {
ll g = gcd(x, y);
ll t = x / g;
if (t > n / y) {
return n + 1;
} else {
return t * y;
}
}
ll n, a, b, c, T;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> T;
while (T--) {
cin >> n >> a >> b >> c;
ll lab = slcm(a, b, n);
ll c1 = (n / a) - (n / lab);
ll c2 = n / c;
ll lac = slcm(a, c, n);
ll ov = (n / lac) - (n / slcm(lac, b, n));
ll ans = c1 + c2 - ov;
printf("%lld",ans);
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
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:
5226515399538632
result:
wrong answer 1st numbers differ - expected: '5', found: '5226515399538632'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3384kb
input:
5 65586 755707 428352 829618 656029 940749 988704 99212 36268 81 74 19 30582 39 65 84 169669 10 30 86
output:
06232696913020
result:
wrong output format Expected integer, but "06232696913020" found
Test #3:
score: 0
Wrong Answer
time: 3ms
memory: 3444kb
input:
5 1000000 823597 291727 302588 1000000 110582 88125 289933 1000000 56 41 6 1000000 97 68 23 1000000 ...
output:
4121782815319427737
result:
wrong answer 1st numbers differ - expected: '4', found: '4121782815319427737'
Test #4:
score: 0
Wrong Answer
time: 3ms
memory: 3444kb
input:
5 1000000 391577 925090 509576 1000000 602666 793626 529237 1000000 34 9 9 1000000 34 31 68 1000000 ...
output:
321372552893735714
result:
wrong answer 1st numbers differ - expected: '3', found: '321372552893735714'
Test #5:
score: 0
Wrong Answer
time: 140ms
memory: 3396kb
input:
100000 296432115736998358 947322129 486697382 491023976 442633183062920521 378805523 642688939 22691...
output:
9166177733119191450294425385423870777575855851019889049512242369622834146792053708470530923551844861...
result:
wrong output format Expected integer, but "916617773311919145029442538542...611546303577373833841537...
Test #6:
score: 0
Wrong Answer
time: 132ms
memory: 3396kb
input:
100000 673374200126361826 331800367 162665250 387080263 144151428834647945 126886572 51580646 287850...
output:
3769080063163685182726401431318504114691298622147892967114589414536387722671366556156158219949847149...
result:
wrong output format Expected integer, but "376908006316368518272640143131...300659754806534059614855...
Test #7:
score: 0
Wrong Answer
time: 132ms
memory: 3504kb
input:
100000 534714905018631481 79508556 404238398 161736622 3826684598814001 497377457 854258623 48373266...
output:
1003133403186801149100240478810758368311272870805130129925040239991784355965548793368120645170476823...
result:
wrong output format Expected integer, but "100313340318680114910024047881...956313683452991712104636...
Test #8:
score: 0
Wrong Answer
time: 134ms
memory: 3564kb
input:
100000 1000000000000000000 366727583 374716263 685187467 1000000000000000000 877263942 598947447 372...
output:
4186274294382395100012291730057112583733003930377537287647947128796852854909612902801049863935830823...
result:
wrong output format Expected integer, but "418627429438239510001229173005...846560846560846944444444...
Test #9:
score: 0
Wrong Answer
time: 135ms
memory: 3428kb
input:
100000 1000000000000000000 979092025 33346302 238829786 1000000000000000000 460728333 175754163 3332...
output:
5208436845321816439669585743799606809850471672261295961403001384372497456858083164804644411383995539...
result:
wrong output format Expected integer, but "520843684532181643966958574379...571428571428572549388595...
Test #10:
score: 0
Wrong Answer
time: 141ms
memory: 3564kb
input:
100000 1000000000000000000 437307257 195856865 910658369 1000000000000000000 384087547 596914446 797...
output:
3384828338151358419183977256414759286074451378189331747599976729047755731425862788896800094268708492...
result:
wrong output format Expected integer, but "338482833815135841918397725641...220035778175314285714285...