ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#239 | #4. 「WyOJ Round 1」启 · 破茧初阳 | zibenlun | 20 | 8ms | 3404kb | C++23 | 2.1kb | 2025-04-18 14:23:09 | 2025-04-18 18:01:10 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define ONLINE_JUDGE
namespace Fread{
const int SIZE = 1 << 16;
char buf[SIZE], *S, *T;
inline char getchar() { if (S == T) { T = (S = buf) + fread(buf, 1, SIZE, stdin); if (S == T) return '\n'; } return *S++; }
}
using namespace Fread;
namespace Fwrite{
const int SIZE = 1 << 16;
char buf[SIZE], *S = buf, *T = buf + SIZE;
inline void flush() { fwrite(buf, 1, S - buf, stdout); S = buf; }
inline void putchar(char c) { *S++ = c; if (S == T) flush(); }
struct NTR { ~NTR() { flush(); } } ztr;
}
using namespace Fwrite;
#define getchar Fread::getchar
#define putchar Fwrite::putchar
namespace Fastio{
struct Reader{
template <typename T> Reader& operator >> (T &x){
x = 0;
short f = 1;
char c = getchar();
while (c < '0' || c > '9') { if (c == '-') f *= -1; c = getchar(); }
while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
x *= f;
return *this;
}
Reader& operator >> (char *str){
int len = 0;
char c = getchar();
while (c == ' ' || c == '\n' || c == '\r') c = getchar();
while (c != ' ' && c != '\n' && c != '\r') str[len++] = c, c = getchar();
str[len] = '\0';
return *this;
}
Reader() {}
} cin;
const char endl = '\n';
struct Writer{
template <typename T> Writer& operator << (T x){
if (x == 0) { putchar('0'); return *this; }
if (x < 0) putchar('-'), x = -x;
static short sta[40];
short top = 0;
while (x > 0) sta[++top] = x % 10, x /= 10;
while (top > 0) putchar(sta[top] + '0'), top--;
return *this;
}
Writer& operator << (const char *str)
{
int cur = 0;
while (str[cur]) putchar(str[cur++]);
return *this;
}
Writer() {}
} cout;
}
using namespace Fastio;
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
#define lowbit(x) (x&(-x))
int t,a,b,c,n;
signed main(){
cin>>t;
while(t--){
cin>>n>>a>>b>>c;
cout<<n/a-n/(a/__gcd(a,b)*b)+n/c-n/(a/__gcd(a,c)*c)+n/(c/__gcd(a,b)*b/__gcd(a*b/__gcd(a,b),c)*a)<<"\n";
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
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:
5 2 2657 53995 38686
result:
wrong answer 3rd numbers differ - expected: '2651', found: '2657'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3404kb
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 970 13030
result:
wrong answer 4th numbers differ - expected: '969', found: '970'
Test #3:
score: 10
Accepted
time: 1ms
memory: 3248kb
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: 3296kb
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
Runtime Error
input:
100000 296432115736998358 947322129 486697382 491023976 442633183062920521 378805523 642688939 22691...
output:
916617773 3119191458 2944253854 238707775 758558510 1988904951 2242369622 83414679 2053708470 530923...
result:
Test #6:
score: 0
Runtime Error
input:
100000 673374200126361826 331800367 162665250 387080263 144151428834647945 126886572 51580646 287850...
output:
3769080063 1636851827 264014313 1850411469 1298622147 8929671 145894145 3638772267 1366556156 158219...
result:
Test #7:
score: 0
Runtime Error
input:
100000 534714905018631481 79508556 404238398 161736622 3826684598814001 497377457 854258623 48373266...
output:
10031334031 86801149 1002404788 10758368311 272870805 1301299250 4023999178 43559655 487933681 20645...
result:
Test #8:
score: 0
Runtime Error
input:
100000 1000000000000000000 366727583 374716263 685187467 1000000000000000000 877263942 598947447 372...
output:
4186274294 3823951000 12291730057 11258373300 3930377537 2876479471 2879685285 4909612902 8010498638...
result:
Test #9:
score: 0
Runtime Error
input:
100000 1000000000000000000 979092025 33346302 238829786 1000000000000000000 460728333 175754163 3332...
output:
5208436845 32181643966 9585743781 6068098505 7167226129 5961403001 3843724974 5685808316 4804644411 ...
result:
Test #10:
score: 0
Runtime Error
input:
100000 1000000000000000000 437307257 195856865 910658369 1000000000000000000 384087547 596914446 797...
output:
3384828338 15135841918 3977256414 7592860744 5137818933 17475999767 29047755731 4258627888 968000942...