QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#585291#9381. 502 Bad GatewaywujhWA 168ms3696kbC++14928b2024-09-23 20:10:202024-09-23 20:10:21

Judging History

你现在查看的是最新测评结果

  • [2024-09-24 14:55:37]
  • hack成功,自动添加数据
  • (/hack/886)
  • [2024-09-23 20:10:21]
  • 评测
  • 测评结果:WA
  • 用时:168ms
  • 内存:3696kb
  • [2024-09-23 20:10:20]
  • 提交

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;
}

/*

*/

详细

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'