题解:P12174 [蓝桥杯 2025 省 Python B] A · B Problem
令
考虑优化。
先枚举
然后求
然后其实
inline void solve(){
n = read();
f(i , 1 , n){
f(j , 1 , n / i){
cnt[i * j] ++;
}
}
f(i , 1 , n)
S[i] = S[i - 1] + cnt[i];
int s = 0;
f(i , 1 , n){
s += cnt[i] * S[n - i];
}
cout << s << '\n';
return;
}
?为啥要 Python 代码的。