40分RE求助
  • 板块P1515 旅行
  • 楼主wnqnld_llx
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/5/29 15:12
  • 上次更新2024/5/29 18:40:27
查看原帖
40分RE求助
1200401
wnqnld_llx楼主2024/5/29 15:12
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,n,ans;
int num[14]={0,990,1010,1970,2030,2940,3060,3930,4060,4970,5030,5990,6010,7000};
bool hotel[7050];
void s(int x){
	if(x==7000){
		ans++;
		return ;
	}
	for(int i=x+a;i<=x+b;i++){
		if(hotel[i]==1){
			s(i);
		}
	}
}
signed main(){
	cin>>a>>b>>n;
	for(int i=0;i<14;i++) hotel[num[i]]=1;
	for(int i=1;i<=n;i++){
		int m;
		cin>>m;
		hotel[m]=1;
	}
	s(0);
	cout<<ans;
	return 0; 
}
2024/5/29 15:12
加载中...