QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#580930 | #9381. 502 Bad Gateway | Retr00 | WA | 0ms | 3676kb | C++20 | 625b | 2024-09-22 01:15:00 | 2024-09-22 01:15:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
int main()
{
int n;
cin >> n;
while (n--)
{
ll T, a, b;
cin >> T;
a = sqrt(2 * T), b = a + 1;
double da = a, db = b, aa, ab;
aa = (da - 1) / 2 + (double)T / da;
ab = (db - 1) / 2 + (double)T / db;
if (ab < aa)
a = b;
ll g = gcd(a * a - a + 2 * n, 2 * a);
cout << (a * a - a + 2 * n) / g << " " << 2 * a / g << '\n';
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3676kb
input:
3 1 2 3
output:
2 1 1 1 1 2
result:
wrong answer 1st lines differ - expected: '1 1', found: '2 1'