QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587632#9381. 502 Bad GatewayNiiuWA 531ms3692kbC++14531b2024-09-24 20:54:182024-09-24 20:54:18

Judging History

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

  • [2024-09-24 20:54:18]
  • 评测
  • 测评结果:WA
  • 用时:531ms
  • 内存:3692kb
  • [2024-09-24 20:54:18]
  • 提交

answer

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


void solve()
{
    int t;
    cin>>t;
    if(t==1)
    {
        cout<<1<<' '<<1<<'\n';
        return ;
    }
    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*c-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: 3692kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 531ms
memory: 3616kb

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
-27473896 4969
1 1
1 1
-27473896 4969
1 1
-27473896 4969
1 1
1 1
1 1
-27473896 4969
1 1
1 1
-27473896 4969
1 1
-27473896 4969
-27473896 4969
1 1
-27473896 4969
1 1
1 1
-27473896 4969
1 1
-27473896 4969
-27473896 4969
1 1
-27473896 4969
-27473896 4969
-27473896 4969
-27473896 4969
-27473896 4969
...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '-27473896 4969'