QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#584642 | #9381. 502 Bad Gateway | Chief_Ning | WA | 487ms | 3596kb | C++14 | 375b | 2024-09-23 16:01:06 | 2024-09-23 16:01:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int x;
cin>>x;
int t1=ceil(sqrt(2*x)),t2=floor(sqrt(2*x));
int k1=((t1-1)*t1+2*x)*t2,k2=((t2-1)*t2+2*x)*t1;
int c=0;
if(k1<k2)c=t1;
else c=t2;
int fz=(c-1)*c+2*x,fm=2*c;
int g=__gcd(fz,fm);
int ans1=fz/g,ans2=fm/g;
cout<<ans1<<" "<<ans2<<endl;
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 487ms
memory: 3496kb
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'