题解:P16232 [蓝桥杯 2026 省 B] 青春常数

· · 题解

大水题。初中数学。

x + y = N\Rightarrow y=N-x

我们需要满足 0\leq x< y,即可变形:

\begin{cases} 0\leq x \\ x<y\Rightarrow x < N - x\Rightarrow 2x<N \end{cases}

于是答案就是 \left\lfloor \dfrac{N}{2}\right\rfloor + 1,本题为 1013101260121012。

代码如下:

#include<bits/stdc++.h>
using namespace std;
using i64 = long long;

const i64 N = 2026202520242023;

int main()
{
    cout << N / 2 + 1;
    return 0;
}