QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586223 | #9381. 502 Bad Gateway | aurorawhitesea | WA | 384ms | 3636kb | C++20 | 1.0kb | 2024-09-24 09:01:55 | 2024-09-24 09:01:56 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <numeric>
using namespace std;
void speed()
{
ios::sync_with_stdio(0);
cin.tie(0);
}
int gcd(int a, int b)
{
if( b == 0 )
return a;
return gcd(b, a % b);
}
int main()
{
speed();
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int x1 = floor(sqrt(2*n));
int x2 = ceil(sqrt(2*n));
int a1 = x1*x1 + 2*n - x1;
int b1 = 2 * x1;
int g = gcd(a1, b1);
a1 /= g, b1 /= g;
int a2 = x2*x2 + 2 *n - x2;
int b2 = 2 * x2;
g = gcd(a2, b2);
a2 /= g, b2 /= g;
if( a1 * b2 < a2 * b1)
{
cout << a1<<" "<<b1<<endl;
}
else
{
cout << a2<<" "<<b2<<endl;
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 384ms
memory: 3572kb
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'