QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#587644 | #9381. 502 Bad Gateway | Niiu | WA | 568ms | 3724kb | C++14 | 453b | 2024-09-24 20:56:25 | 2024-09-24 20:56:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int t;
cin>>t;
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*2-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: 3620kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 568ms
memory: 3724kb
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 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 1 1 1 1 1 1 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 147522088 -44721 1 1 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 147522088 -44721 1 1 147522088 -44721 147522088 -44721 147522088 -44721 14...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '147522088 -44721'