POJ-2626 DP
来源:互联网 发布:三国杀神武将排名知乎 编辑:程序博客网 时间:2024/06/03 20:01
最近老有低级错误出现。。。状态不佳。。。
/* * POJ-2626 chess * mike-w * 2011-11-4 * ------------------ * tag: DP * ------------------ * f[n][i][j]: 前n个人中选i个white,j个black的最优值 * ------------------ * 最近怎么老犯低级错误?! */#include<stdio.h>#include<stdlib.h>int f[1010][20][20];int N;inline int max3(int a,int b,int c){int ret=a;if(ret<b) ret=b;if(ret<c) ret=c;return ret;}inline int max2(int a,int b){return a>b?a:b;}int main(void){int white,black,i,j;#ifndef ONLINE_JUDGEfreopen("in","r",stdin);#endifwhile(scanf("%d%d",&white,&black)!=EOF){N++;for(i=1;i<=15;i++) /* <= 不知怎么回事,我刚才竟晕头打成 i>=N */{f[N][i][0]=max2(f[N-1][i-1][0]+white, f[N-1][i][0]);f[N][0][i]=max2(f[N-1][0][i-1]+black, f[N-1][0][i]);for(j=1;j<=15;j++)f[N][i][j]=max3(f[N-1][i-1][j]+white,f[N-1][i][j-1]+black,f[N-1][i][j]);}}printf("%d\n",f[N][15][15]);return 0;}
- POJ-2626 DP
- POJ 2626 Chess(dp)
- poj dp
- 【dp】POJ
- 【dp】POJ
- [DP] POJ
- [DP] POJ
- [DP] POJ
- 【dp】POJ
- poj 2626 三维dp 0 1 bag
- POJ 3670 && POJ 3671 (dp)
- 【DP】 POJ 1080
- poj 1163经典DP
- poj 1088 滑雪(DP)
- poj 1770 树形dp
- POJ 1179 Polygon(DP)
- POJ 1221 dp
- POJ 1953 DP
- 移动用户体验设计的七大原则
- cisco交换机命令汇总
- Memory Alignment
- 第3章练习题--2--八进制到十进制--2735
- 深入Bash___调试
- POJ-2626 DP
- 时钟类---swing画图、Timer、JFrame用法示例
- 第3章练习题--3--二进制转换为十六进制--2798
- MySQL里的选出分组极值行
- Swing组件
- HTML 5的革新:结构之美
- php脱裤脚本
- bash变量赋值及字符串的操作
- 使用FCKeditor的惨痛教训!网页制作千万要标准啊!