QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#584262 | #9381. 502 Bad Gateway | nuo | WA | 159ms | 3896kb | C++20 | 780b | 2024-09-23 11:00:15 | 2024-09-23 11:00:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, T;
int gcd(int a, int b) { return a == 0 ? b : gcd(b % a, a); }
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
cin >> n;
while (n--) {
cin >> T;
int num1 = floor(sqrt(2 * T)), num2 = ceil(sqrt(2 * T));
int x1 = 2 * T + num1 * (num1 - 1), y1 = 2 * num1;
int x2 = 2 * T + num2 * (num2 - 1), y2 = 2 * num2;
int GCD;
if (x1 * y2 > x2 * y1) {
GCD = gcd(x1, y1);
x1 /= GCD, y1 /= GCD;
printf("%lld %lld\n", x1, y1);
} else {
GCD = gcd(x2, y2);
x2 /= GCD, y2 /= GCD;
printf("%lld %lld\n", x2, y2);
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3896kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 159ms
memory: 3876kb
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'