QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#742244 | #3135. Mining a | ucup-team5226# | AC ✓ | 282ms | 3712kb | C++20 | 930b | 2024-11-13 16:10:03 | 2024-11-13 16:10:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ov4(a, b, c, d, name, ...) name
#define rep3(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define rep2(i, a, b) rep3(i, a, b, 1)
#define rep1(i, n) rep2(i, 0, n)
#define rep0(n) rep1(aaaaa, n)
#define rep(...) ov4(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
const ll INF = LLONG_MAX / 4;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vc<vector<T>>;
void solve() {
ll n;
cin >> n;
ll res = 0;
for (ll b = n + 1; b <= 2 * n; b++) {
if ((n * b) % (b - n)) continue;
ll ab = n * b / (b - n);
ll a = ab ^ b;
res = max(res, a);
}
cout << res << endl;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(20);
ll t = 1;
cin >> t;
for (int i = 1; i <= t; i++) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3572kb
input:
3 6 7 10
output:
45 48 101
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 23ms
memory: 3608kb
input:
3 1 2 7777777
output:
0 5 60493819864864
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 282ms
memory: 3712kb
input:
20 5352 7774 898767 9999999 2019102 10000000 3424123 8998231 1234 1241564 8888959 5411738 200000 2345235 9902352 9092342 2909525 9090909 4532423 9191991
output:
28652481 60446397 807782253792 99999983156992 4076773743037 100000017825793 11724620970984 80968179092912 1525189 1541483271985 79013592252160 29286916841381 40000131073 5500131830120 98056577753857 82670700086701 8465341544152 82644644558968 20542867168176 84492699625520
result:
ok 20 lines