QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586700 | #9381. 502 Bad Gateway | ucup-team1769 | WA | 169ms | 3788kb | C++20 | 935b | 2024-09-24 15:06:35 | 2024-09-24 15:06:35 |
Judging History
answer
#include <bits/stdc++.h>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
void solve() {
int n;
std::cin >> n;
for (int i = 0; i < n; i++) {
i64 t;
std::cin >> t;
i64 a = floor(std::sqrt(2 * t));
i64 b = ceil(std::sqrt(2 * t));
i64 a_ = (a - 1) * a + 2 * t;
i64 b_ = (b - 1) * b + 2 * t;
i64 _a = 2 * a;
i64 _b = 2 * b;
i64 ga = std::gcd(a_, _a);
i64 gb = std::gcd(b_, _b);
a_ /= ga, _a /= ga;
b_ /= gb, _b /= gb;
if (a_ * _b > b_ * _a) {
std::cout << a_ << " " << _a << "\n";
} else {
std::cout << b_ << " " << _b << "\n";
}
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
//std::cin >> t;
t = 1;
while (t--) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3700kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 169ms
memory: 3788kb
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 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 1 1 1 1 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 2000006281 44722 2000006281 44722 20...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '2000006281 44722'