为什么#11 #12TLE
查看原帖
为什么#11 #12TLE
1454472
Cinry_zhang楼主2025/1/20 14:23

80分求调

#include<bits/stdc++.h>
using namespace std;
const int maxn=1005;
bool b[maxn];
long long m[10]={0,1,2,3,5,10,20};
long long a[10],ans;
void dfs(int d,int z){
	if(d==7){
		if(!b[z]){
			b[z]=1;
			ans++;
		}
		return;
	}
	for(int i=0;i<=a[d];i++)
		dfs(d+1,z+i*m[d]);
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	for(int i=1;i<=6;i++)
		cin>>a[i];
	dfs(1,0);
	cout<<"Total="<<ans-1;
	return 0;
}
2025/1/20 14:23
加载中...