QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#582719 | #9381. 502 Bad Gateway | jack | WA | 165ms | 3620kb | C++14 | 686b | 2024-09-22 17:15:28 | 2024-09-22 17:15:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
void solve()
{
int n;
cin>>n;
ll p=(ll)sqrt((ll)2*n);
ll q=p+1;
ll f1=p*p-p+2*n;
ll s1=2*p;
double h=double(f1/s1);
ll f2=q*q-q+2*n;
ll s2=2*q;
double h1=double(f2/s2);
if(q>n)
{
h1=1000;
}
if(h<h1)
{
cout<<f1/__gcd(f1,s1)<<' '<<s1/__gcd(f1,s1)<<'\n';
}else
{
cout<<f2/__gcd(f2,s2)<<' '<<s2/__gcd(f2,s2)<<'\n';
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 165ms
memory: 3620kb
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'