题解:P15430 [蓝桥杯 2025 国 Python B] 等差数列计数

· · 题解

传送门
写一个无脑暴力求解的代码就可以把答案求出来了。

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

int main()
{
    int ans = 0;
    for(int i = 1;i*2+1<=2025;i++)
    {
        for(int j = 1;j+2*i<=2025;j++)
        {
            ans++;
        }
    }
    cout <<ans*2; //从小到大,从大到小都要计算
    return 0;
}

答案就是 2048288。