QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#580385 | #9381. 502 Bad Gateway | ttyymm | WA | 359ms | 3760kb | C++17 | 403b | 2024-09-21 21:38:33 | 2024-09-21 21:38:34 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,t;
signed main(){
ios::sync_with_stdio(0);
cin>>n;
while(n--){
cin>>t;
int l=floor(sqrt(2*t)),r=ceil(sqrt(2*t)),s;
long double ans1=(l*(l-1)+2*t)/2/l,ans2=(r*(r-1)+2*t)/2/r;
ans1<ans2?s=l:s=r;
int fz=s*(s-1)+2*t,fm=2*s;
int p=__gcd(fz,fm);
fz/=p,fm/=p;
cout<<fz<<" "<<fm<<endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3760kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 359ms
memory: 3760kb
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 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 1 1 1 1 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 2000006281 44722 2000006281 44722 20...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '2000006281 44722'