为何编译失败??
查看原帖
为何编译失败??
915569
Patrick_Liu_Bingxian楼主2025/7/24 11:01

本地都过了,为何会编译失败呢?? 代码:

#include<bits/stdc++.h>
using namespace std;
const int N=2e2+5,M=1e7+5;
int c[N],dp[M]={INT_MAX};
int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int k,n;
	cin>>k>>n;
	for(int i=1;i<=n;i++){
		cin>>c[i];
	}
	sort(c+1,c+n+1);
	dp[0]=0;dp[1]=1;
	int x;
	for(int i=2;i<=k*(1e4+1);i++){
		for(int j=1;j<=n;j++){
			if(i-c[j]>=0){
				dp[i]=dp[i-c[j]]+1;
			}
		}
		if(dp[i]>k){
			x=i-1;
			break;
		}
	}
	cout<<x;
	return 0;
}

求调,plz

2025/7/24 11:01
加载中...