QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#584497 | #9381. 502 Bad Gateway | moosy | WA | 187ms | 3704kb | C++20 | 657b | 2024-09-23 14:52:38 | 2024-09-23 14:52:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void Solve() {
ll n; cin >> n;
ll x = ceil(sqrt(2 * n));
ll y = ceil(sqrt(2 * n)) == sqrt(2 * n) ? x : x - 1;
ll a1 = x * x + 2 * n - x; ll b1 = 2 * x;
ll a2 = y * y + 2 * n - y; ll b2 = 2 * y;
if(a1 * b2 >= a2 * b1) {
cout << a1 / __gcd(a1, b1) << " " << b1 / __gcd(a1, b1) << "\n";
} else {
cout << a2 / __gcd(a2, b2) << " " << b2 / __gcd(a2, b2) << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
ll t; cin >> t;
while(t -- ) {
Solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 187ms
memory: 3704kb
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'