2011年7月31日

max sum 不用考虑全是负数。。

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int dp[100010];int main( ){ int T, i, j, N, a, b, c, d, l, max, sum, flag ; scanf("%d",&T); l = 0; while (T--) { l++; //sum = max = 0; memset(dp, 0, sizeof(dp)); scanf("%d",&N); for (i = 1; i <= 阅读全文

posted @ 2011-07-31 20:16 more think, more gains 阅读(275) 评论(0) 推荐(0) 编辑

最大连续子序列

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int dp[11100];int main( ){ int T, i, j, max = 0, sum; int a, b, c, d; while ( scanf("%d",&T) , T ) { for (i = 0; i < T; i++) scanf("%d",&dp[i]); a = b = c = d = max = sum = dp[0]; for (i = 1; i & 阅读全文

posted @ 2011-07-31 19:37 more think, more gains 阅读(166) 评论(0) 推荐(0) 编辑

i need a office

摘要: 二维。 滚动数组。。93ms 444kb#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;int main( ){ int n, m, i, j; double dp[3][10010]; int mo[1010]; double p[1010]; while (scanf("%d%d", &n, &m), n || m ) { for (i = 0; i <= 2 阅读全文

posted @ 2011-07-31 14:27 more think, more gains 阅读(137) 评论(0) 推荐(0) 编辑

最少拦截系统

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int main( ){ int dp[10000]; int N, i, j, num, t; while (scanf("%d", &N) != EOF ) { num = 0; for (i = 0; i < N; i++) scanf("%d",&dp[i]); for (i = 0; i < N; i++) { if (dp[i] != -1) { t = dp[i], 阅读全文

posted @ 2011-07-31 12:08 more think, more gains 阅读(132) 评论(0) 推荐(0) 编辑

数塔

摘要: 状态方程: dp[i][j] += max (dp[i-1][j],dp[i-1][j-1]);#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;int main( ){ int T, N, i, j, t; int dp[110][110]; scanf("%d",&T); while (T--) { t = 0; memset(dp, 0, sizeof(dp)); scan 阅读全文

posted @ 2011-07-31 11:57 more think, more gains 阅读(132) 评论(0) 推荐(0) 编辑

bone collector3

摘要: 一维。。0ms 198kb#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;int main( ){ int N,T,V,dp[1100],value[1100],volume[1100]; scanf("%d",&T); while (T--) { int i, j; scanf("%d%d",&N,&V); for (i = 1; i &l 阅读全文

posted @ 2011-07-31 11:32 more think, more gains 阅读(102) 评论(0) 推荐(0) 编辑

bone collector1

摘要: 二维。46ms .4936kb#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std; int T, M, N, V, i, j, dp[1100][1100], value[1100], volume[1100];void print( ){ int i, j;for ( i = 0; i <= N; i++) { for ( j = 0; j <= V; j++) printf("%d 阅读全文

posted @ 2011-07-31 11:31 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

bone collector

摘要: 滚动数组。二维。。31ms 212kB#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std; int T, M, N, V, i, j, dp[3][1100], value[1100], volume[1100];int main( ){ scanf("%d",&T); while (T--) { scanf("%d%d",&N,&V); mem 阅读全文

posted @ 2011-07-31 11:30 more think, more gains 阅读(106) 评论(0) 推荐(0) 编辑

导航