题目友链:https://loj.ac/problem/515
话说这题蛮简单,bitset暴力直接过.
话不多说,上代码!
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n, a, b;
bitset<maxn> f[110];
int main() {
cin >> n;
f[0].set(0);
for (int i = 1; i <= n; i++) {
f[i].reset();
for (cin >> a >> b; a <= b; a++) //极简暴力写法
f[i] |= f[i - 1] << (a * a);
}
cout << f[n].count(); //输出答案
return 0; //拜拜程序
}