1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int dp[105][105],a[105][105]; int main(){ int n; cin >> n; for (int i = 1;i<=n;i++){ for (int j = 1;j<=i;j++) cin >> a[i][j]; } for (int i = n;i>=1;i--){ for (int j = 1;j<=i;j++) dp[i][j] = min(dp[i+1][j],dp[i+1][j+1]) + a[i][j]; } cout << dp[1][1]; return 0; }
- 1
Information
- ID
- 106
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By