LightOJ 1047 - Neighbor House(dp)
来源:互联网 发布:淘宝定金尾款凑单 编辑:程序博客网 时间:2024/05/18 07:31
题目链接:LightOJ 1047 - Neighbor House
代码
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 30;const int inf = 0x3f3f3f3f;int N, dp[maxn][3];int main () { int cas; scanf("%d", &cas); for (int kcas = 1; kcas <= cas; kcas++) { scanf("%d", &N); for (int i = 1; i <= N; i++) { for (int j = 0; j < 3; j++) scanf("%d", &dp[i][j]); } for (int i = 2; i <= N; i++) { for (int j = 0; j < 3; j++) { int s = inf; for (int k = 0; k < 3; k++) if (j != k) s = min(s, dp[i-1][k]); dp[i][j] += s; } } int ans = inf; for (int i = 0; i < 3; i++) ans = min (ans, dp[N][i]); printf("Case %d: %d\n", kcas, ans); } return 0;}
0 0
- lightOJ 1047 Neighbor House (DP)
- LightOJ 1047 - Neighbor House(dp)
- LightOJ 1047 - Neighbor House (dp)
- LightOj 1047 Neighbor House(基础dp)
- 【LightOJ】1047 - Neighbor House(dp)
- LightOJ 1047 - Neighbor House 【DP】
- lightoj 1047 Neighbor House(Dp)
- LightOJ - 1047 Neighbor House(DP)
- LightOJ 1047 - Neighbor House(DP)
- lightoj 1047 - Neighbor House DP
- 【 lightoj 1047 - Neighbor House + dp】
- lightoj 1047 - Neighbor House DP(简单线性DP)
- LightOJ 1047 Neighbor House (DP 数字三角形变形)
- LightOJ 1047 Neighbor House (DP 数字三角形变形)
- lightoj-1047-Neighbor House【矩阵DP】
- LightOJ - 1217 Neighbor House (II)(dp)
- LightOJ 1047 - Neighbor House
- LightOJ 1047 - Neighbor House
- LightOJ 1038 - Race to 1 Again(dp)
- Swift(十五、构造过程(2)及析构过程)
- spring整合hibernate和spring MVC
- 多备份为国产大飞机助推者恒润科技构建IT保护平台
- LightOJ 1044 - Palindrome Partitioning(dp)
- LightOJ 1047 - Neighbor House(dp)
- 严重: Context [] startup failed due to previous errors
- java设置客户端缓存控制:session保留时间
- LightOJ 1050 - Marbles(dp)
- ios 后台录音权限设置
- LightOJ 1051 - Good or Bad(dp)
- SQL去空格
- LightOJ 1057 - Collecting Gold(dp)
- Ubuntu下配置samba服务器