uva590 - Always on the run(简单动归)
摘要:
状态:dp[i][j]表示第i天到达j号城市的最小花费状态转移:dp[i][j] = min(dp[i-1][k]);注意边界是dp[0][1] = 0,而不是dp[1][1] = 0;代码如下:#include #include #define N 15
#define K 1005
#define INF 0x7fffffff
int n, k, d, dp[K][N], a[N][N][K];
int main ()
{ int tt = 0; while(scanf("%d %d",&n,&k),n+k) { for(int i = 1; i... 阅读全文