【每日一题】简单瞎搞题
简单瞎搞题
http://www.nowcoder.com/questionTerminal/89e3ced7ad9b4874959f2b3679ae0bbf
#include <cstdio> #include <bitset> using namespace std; const int N = 105; bitset<N*N*N> b[105]; int n,l[N],r[N]; int main(){ scanf("%d",&n); for(int i = 1;i <= n;i++) scanf("%d%d",l+i,r+i); b[0].set(0); for(int i = 1;i <= n;i++){ for(int j = l[i];j <= r[i];j++){ b[i]|=(b[i-1]<<(j*j)); } } printf("%d\n",b[n].count()); return 0; }