QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587644#9381. 502 Bad GatewayNiiuWA 568ms3724kbC++14453b2024-09-24 20:56:252024-09-24 20:56:25

Judging History

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

  • [2024-09-24 20:56:25]
  • 评测
  • 测评结果:WA
  • 用时:568ms
  • 内存:3724kb
  • [2024-09-24 20:56:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;


void solve()
{
    int t;
    cin>>t;
    int c=sqrt(2.0*t);
    double x=(c*1.0)/2+(t*1.0)/c,y=((c+1)*1.0)/2+(t*1.0)/(c+1);
    if(x>y)
    {
        c++;
    }
    int xx=c*c+t*2-c;
    int yy=2*c;
    int g=__gcd(xx,yy);
    //cout<<g<<'\n';
    cout<<xx/g<<' '<<yy/g<<'\n';
}

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 568ms
memory: 3724kb

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'