HDU 1300 Pearls(dp)
2016-09-25 09:38
405 查看
这题题目里说了,给出的数据是有一定递增的,所以不用排序。
// // main.cpp // Richard // // Created by 邵金杰 on 16/9/25. // Copyright © 2016年 邵金杰. All rights reserved. // #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; const int maxn=1000+5; struct node{ int a,p; }c[maxn]; ll dp[maxn]; int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) dp[i]=9999999999999999; for(int i=1;i<=n;i++) scanf("%d%d",&c[i].a,&c[i].p); dp[0]=0; for(int i=1;i<=n;i++) { ll sum=c[i].a; for(int j=i-1;j>=0;j--) { dp[i]=min(dp[i],(sum+10)*c[i].p+dp[j]); sum+=c[j].a; } } cout<<dp <<endl; } return 0; }
相关文章推荐
- hdu 1300 Pearls(dp)
- HDU 1300 Pearls DP .
- HDU 1300 Pearls(DP)
- HDU 1300 Pearls(dp)
- HDU - 1300 Pearls (dp)
- 【DP】HDU-1300 Pearls
- HDU_1300 Pearls 【DP】
- POJ 1260 && HDU 1300 Pearls(dp)
- hdu1300 Pearls--DP
- hdu 1300 Pearls(DP)
- HDU 1300 Pearls 动态规划 dp
- HDU 1300 Pearls(DP)
- hdu 1300 Pearls【dp】
- HDU 1300 Pearls (DP)
- hdu 1300 Pearls(dp)
- HDU 1300 Pearls--dp
- HDU 1300 Pearls (dp)
- hdu 1300 Pearls (dp)
- hdu 1300 Pearls(dp)
- HDU 1300 POJ 1260 Pearls (DP)