QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#587632 | #9381. 502 Bad Gateway | Niiu | WA | 531ms | 3692kb | C++14 | 531b | 2024-09-24 20:54:18 | 2024-09-24 20:54:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int t;
cin>>t;
if(t==1)
{
cout<<1<<' '<<1<<'\n';
return ;
}
int c=sqrt(2.0*t);
double x=(c*1.0)/2+(t*1.0)/c,y=((c+1)*1.0)/2+(t*1.0)/(c+1);
if(x>y)
{
c++;
}
int xx=c*c+t*c-c;
int yy=2*c;
int g=__gcd(xx,yy);
//cout<<g<<'\n';
cout<<xx/g<<' '<<yy/g<<'\n';
}
int main()
{
int T;
cin>>T;
while(T--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3692kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 531ms
memory: 3616kb
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 -27473896 4969 1 1 1 1 -27473896 4969 1 1 -27473896 4969 1 1 1 1 1 1 -27473896 4969 1 1 1 1 -27473896 4969 1 1 -27473896 4969 -27473896 4969 1 1 -27473896 4969 1 1 1 1 -27473896 4969 1 1 -27473896 4969 -27473896 4969 1 1 -27473896 4969 -27473896 4969 -27473896 4969 -27473896 4969 -27473896 4969 ...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '-27473896 4969'