Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
67623 | 老师 | 最小乘车费用 | C++ | Wrong Answer | 0 | 0 MS | 288 KB | 322 | 2023-01-14 17:28:31 |
#include<bits/stdc++.h> using namespace std; const int M=10010,N=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; }