QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587607#9381. 502 Bad GatewayNiiuWA 0ms3580kbC++14421b2024-09-24 20:48:402024-09-24 20:48:42

Judging History

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

  • [2024-09-24 20:48:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-09-24 20:48:40]
  • 提交

answer

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


void solve()
{
    int t;
    cin>>t;
    int c=sqrt(2*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*c-c;
    int yy=2*c;
    int g=__gcd(xx,yy);
    cout<<xx/g<<' '<<yy/g<<'\n';
}

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

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

3
1
2
3

output:

1 2
3 2
2 1

result:

wrong answer 1st lines differ - expected: '1 1', found: '1 2'