Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
67307 陶俊宸 最小乘车费用 C++ Accepted 100 0 MS 236 KB 360 2023-01-12 16:11:45

Tests(7/7):


#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int k,c[10],dp[10001]; int main(){ memset(dp,0x3f,sizeof dp); dp[0]=0; for(int i=0;i<10;i++) scanf("%d",&c[i]); scanf("%d",&k); for(int i=1;i<=k;i++){ for(int j=1;j<=10;j++){ if(i>=j) dp[i]=min(dp[i],dp[i-j]+c[j-1]); } } printf("%d",dp[k]); return 0; }


Judgement Protocol: