#11 TLE 求调
查看原帖
#11 TLE 求调
1334925
The_foolishest_OIer楼主2024/8/1 16:58
#include <bits/stdc++.h>
using namespace std;
int v[10],f[1005],ans;
const int r[7] = {0,1,2,3,5,10,20};
void dfs (int y,int tot){
	if (y > 6){
		f[tot] = 1;
	}else{
		for (int i = 0 ; i <= v[y] ; i++){
			dfs (y + 1,tot + (i * r[y]));
		}
	}
}
int main(){
    for (int i = 1 ; i <= 6 ; i++) cin >> v[i];
    dfs (1,0);
    for (int i = 1 ; i <= 1000 ; i++){
    	if (f[i]){
    		ans++;
		}
	}
    printf ("Total=%d",ans);
    return 0;
}
2024/8/1 16:58
加载中...