简单瞎搞题

链接:https://ac.nowcoder.com/acm/problem/17193

 

 

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 const int N = 1000100;
 4 bitset<N>s,p;
 5 int main() {
 6     int i,n,j,x,y;
 7     cin>>n;
 8     s[0]=1;
 9     for(i=1;i<=n;i++) {
10         cin>>x>>y;
11         p.reset();
12         for(j=x;j<=y;j++) {
13             p|=(s<<(j*j));
14         }
15         s=p;
16     }
17     cout<<s.count()<<endl;
18     return 0;
19 }

 

posted @ 2021-05-08 11:14  古比  阅读(49)  评论(0编辑  收藏  举报