QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#586984 | #9381. 502 Bad Gateway | ewewe | WA | 352ms | 3636kb | C++14 | 596b | 2024-09-24 16:55:21 | 2024-09-24 16:55:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x,long long y)
{
if (x<y)
swap(x,y);
if (y==0)
return x;
else
return gcd(y,x%y);
}
void solve()
{
long long T;
cin>>T;
if (T%2==1)
{
long long x=T*T+8*T-1;
long long y=4*T+4;
long long g=gcd(x,y);
cout<<x/g<<" "<<y/g<<endl;
}
else
{
long long x=T*T+10*T;
long long y=4*T+8;
long long g=gcd(x,y);
cout<<x/g<<" "<<y/g<<endl;
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tt;
cin>>tt;
while(tt--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 352ms
memory: 3572kb
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1 125000001250000000 500000001 1 1 1 1 125000001250000000 500000001 1 1 125000001250000000 500000001 1 1 1 1 1 1 125000001250000000 500000001 1 1 1 1 125000001250000000 500000001 1 1 125000001250000000 500000001 125000001250000000 500000001 1 1 125000001250000000 500000001 1 1 1 1 1250000012500000...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '125000001250000000 500000001'