QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#585291 | #9381. 502 Bad Gateway | wujh | WA | 168ms | 3696kb | C++14 | 928b | 2024-09-23 20:10:20 | 2024-09-23 20:10:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define quick ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f;
const ll L_INF=9223372036854775807;
const double eps = 1e-9;
const int mod = 1e9+7;
const int N=5e5+5;
int gcd(int x,int y){
if(y==0){
return x;
}
return gcd(y,x%y);
}
int t;
void run(){
cin>>t;
int c=(int)sqrt(2*t);
int x,y;
x=c*(c-1)+2*t;
y=2*c;
int g=gcd(x,y);
x=x/g;
y=y/g;
c++;
int a,b;
a=c*(c-1)+2*t;
b=2*c;
g=gcd(a,b);
a=a/g;
b=b/g;
if(a*y<b*x){
x=a;
y=b;
}
cout<<x<<' '<<y<<'\n';
}
int main(){
quick;
int T=1;
cin>>T;
while(T--){
run();
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 168ms
memory: 3696kb
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'