其他分享
首页 > 其他分享> > 2022/8/16 总结

2022/8/16 总结

作者:互联网

A.数字

Solution

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

inline int read(){
	int s=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		s=s*10+int(ch-'0');
		ch=getchar();
	}
	return s*f;
}

const int N=105;
const int M=1e6+10;

#define re register

int n;
bitset<M>f[N];

int main(){
	freopen("number.in","r",stdin);
//	freopen("number.out","w",stdout);
	n=read();
	int a,b;
	f[0].set(0);
	for(int i=1;i<=n;++i){
		a=read(),b=read();
		for(int j=a;j<=b;++j)
			f[i]|=f[i-1]<<(j*j);
	}
	printf("%d",f[n].count());
	return 0;
}

标签:总结,10,ch,16,int,2022,mathtt,DP,getchar
来源: https://www.cnblogs.com/Star-LIcsAy/p/16592871.html