| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 112126 | 陈家宝 | 使用最小花费爬楼梯 | C++ | Wrong Answer | 0 | 0 MS | 320 KB | 432 | 2023-11-25 10:35:32 |
#include <bits/stdc++.h> using namespace std; int m,n,w[1001],c[1001],f[1001][1001]; int main() { cin>>m>>n; for(int i=1; i<=n; i++) cin>>w[i]>>c[i]; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ if(j>=w[i]) f[i][j]=max(f[i-1][j-w[i]]+c[i],f[i-1][j]); else f[i][j]=f[i-1][j]; } } cout<<f[n][m]; return 0; }