QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#754646 | #9381. 502 Bad Gateway | YipChip# | Compile Error | / | / | C++23 | 597b | 2024-11-16 15:28:53 | 2024-11-16 15:28:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
typedef long long ll;
void solve()
{
int n;
cin >> n;
ll t = sqrt(n << 1);
ll u1 = (t - 1) * t + 2 * n;
ll d1 = 2 * t;
t = t + 1;
ll u2 = (t - 1) * t + 2 * n;
ll d2 = 2 * t;
if ((__int128)u1 * d2 > (__int128)u2 * d1) u1 = u2, d1 = d2;
cout << u1 / __gcd(u1, d1) << " " << d / __gcd(u1, d1) << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
cin >> T;
while (T -- ) solve();
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:17:42: error: ‘d’ was not declared in this scope; did you mean ‘d2’? 17 | cout << u1 / __gcd(u1, d1) << " " << d / __gcd(u1, d1) << "\n"; | ^ | d2