QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#588847 | #9381. 502 Bad Gateway | sn933 | WA | 149ms | 3644kb | C++20 | 751b | 2024-09-25 14:53:12 | 2024-09-25 14:53:13 |
Judging History
answer
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define int long long
#define ull unsigned long long
#define ii __int128
#define endl '\n'
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const double pi=acos(-1.0);
const int N=1e5+5;
int t;
void solve(){
cin>>t;
int l=floor(sqrtl(2*t));
int r=ceil(sqrtl(2*t));
int xl=2*t+l*(l-1),yl=2*l;
int dl=__gcd(xl,yl);
xl/=dl;yl/=dl;
int xr=xl=2*t+r*(r-1),yr=2*r;
int dr=__gcd(xr,yr);
xr/=dr,yr/=dr;
if((ii)(xl)*yr<(ii)(xr)*yl){
cout<<xl<<' '<<yl<<endl;
}else{
cout<<xr<<' '<<yr<<endl;
}
}
signed main(){
IOS;
int _=1;
cin>>_;
while(_--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 149ms
memory: 3644kb
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'