NOIP2026 赛后复盘
我估计没分😭,主要是一开始就去做第二题,第一题快结束才开始做。
Chord
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int c, t;
cin >> c >> t;
while (t--) {
ll a, b;
cin >> a >> b;
if (a > b) swap(a, b);
ll d = b - a;
if (d == 0) {
cout << a << '\n';
continue;
}
vector<ll> divs;
for (ll i = 1; i * i <= d; ++i) {
if (d % i == 0) {
divs.push_back(i);
if (i * i != d) divs.push_back(d / i);
}
}
ll ans = LLONG_MAX;
for (ll g : divs) {
ll k = d / g;
ll L = (a + g - 1) / g;
ll m = L;
while (gcd(m, k) != 1) ++m;
ll cur = g * m * (m + k);
ans = min(ans, cur);
}
cout << ans << '\n';
}
return 0;
}未尽,等待更新
NOIP2026 赛后复盘
https://blog.mxdyeah.com/post/noip2026-saihoufupan