Submit Time:2023-01-27 00:05:22
运行 ID: 67843
#include<bits/stdc++.h> using namespace std; const int M=10010; int a[11],dp[M]; int main(){ memset(dp,0x3f,sizeof dp); for(int i=1;i<=10;i++) cin>>a[i]; int n; cin>>n; for(int i=1;i<=10;i++){ for(int j=i;j<=n;j++){ dp[j]=min(dp[j],dp[j-i]+a[i]); } } cout<<dp[n]<<endl; return 0; }