第一次碰到博弈论题目,是很棘手,博弈论题目要考虑全局最优的解法,我第一次用了局部最优的,而且vector也没pop_front()操作。后来看了网上的用dp的方法解的。

博弈论的题目基本都得用dp法子,因为你得从最简单的情况开始向上推算。

 /*
 ID: yingzho1
 LANG: C++
 TASK: game1
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>
 #include <cmath>
 #include <list>
 #include <cstdio>
 #include <cstdlib>
 #include <limits>
 #include <stack>

 using namespace std;

 ifstream fin("game1.in");
 ofstream fout("game1.out");

 int N;

 int main()
 {
     fin >> N;
     vector<int> board(N);
     ;
     vector<vector<int> > score(N, vector<int>(N)), sum(N, vector<int>(N));
     ; i < N; i++) {
         fin >> board[i];
         total += board[i];
         sum[i][i] = score[i][i] = board[i];
     }
     ; i < N; i++) {
         ; j < N; j++) {
             sum[i][j] = sum[i][j-] + board[j];
         }
     }
     ; l < N; l++) {
         ; i < N-l; i++) {
             score[i][i+l] = sum[i][i+l] - min(score[i][i+l-], score[i+][i+l]);
         }
     }
     fout << score[][N-] << ][N-] << endl;

     ;
 }

USACO Section 3.3: A Game的更多相关文章

  1. USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

    usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...

  2. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

  3. USACO Section 3.3 Camlot(BFS)

    BFS.先算出棋盘上每个点到各个点knight需要的步数:然后枚举所有点,其中再枚举king是自己到的还是knight带它去的(假如是knight带它的,枚举king周围的2格(网上都这么说,似乎是个 ...

  4. [IOI1996] USACO Section 5.3 Network of Schools(强连通分量)

    nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. --------- ...

  5. USACO Section 5.3 Big Barn(dp)

    USACO前面好像有类似的题目..dp(i,j)=min(dp(i+1,j),dp(i+1,j+1),dp(i,j+1))+1  (坐标(i,j)处无tree;有tree自然dp(i,j)=0) .d ...

  6. USACO Section 1.3 Prime Cryptarithm 解题报告

    题目 题目描述 牛式的定义,我们首先需要看下面这个算式结构: * * * x * * ------- * * * <-- partial product 1 * * * <-- parti ...

  7. USACO Section 1.1 Your Ride Is Here 解题报告

    题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...

  8. USACO Section 1.1-1 Your Ride Is Here

    USACO 1.1-1 Your Ride Is Here 你的飞碟在这儿 众所周知,在每一个彗星后都有一只UFO.这些UFO时常来收集地球上的忠诚支持者.不幸的是,他们的飞碟每次出行都只能带上一组支 ...

  9. USACO section 1.1 C++题解

    USACO section1.1:DONE 2017.03.03 TEXT Submitting Solutions DONE 2017.03.04 PROB Your Ride Is Here [A ...

  10. USACO Section 1.1PROB Your Ride Is Here

    题目传送门 不能提交哦   http://www.nocow.cn/index.php/Translate:USACO/ride /* ID: jusonal1 PROG: ride LANG: C+ ...

随机推荐

  1. 用 Android-X86 和 VirtualBox 玩安卓游戏

    目前的系统是 Ubuntu 14.04,近日玩了玩 flash 版的<皇家禁卫军:前线>塔防游戏,还是想试试原生安卓游戏的表现.发现大概有两个选择: 各类安卓模拟器:官方SDK模拟器,bl ...

  2. ExtJS登陆页面涉及到的几个问题

    1.如何在文本框中增加提示信息      输入框中无法直接使用tooltip,需要使用单独的代码 var tip = Ext.create('Ext.tip.ToolTip', { target : ...

  3. linux命令集——<一>目录处理命令

    1.ls,命令,显示当前目录下文件 命令 所在路径 功能描述 执行权限 选项 说明 ls /bin/ls 显示目录文件 所有用户可用 -a 显示所有文件,包括隐藏文件         -l 显示详细信 ...

  4. 【bzoj1010】[HNOI2008]玩具装箱toy

    1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 9281  Solved: 3719[Submit][St ...

  5. HDAO one error

    对normal target设置的background clearcolor 导致 远处天空 通过了 normalRejectTest 所以要对normal target单独设置 不能通过test的 ...

  6. HDU1005Number Sequence(找规律)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  7. google大赛 入围赛250分真题

    Problem StatementYou have a collection of music files with names formatted as "genre-artist-alb ...

  8. Mac中安装maven3.2.1

    Mac中安装maven3.2.1 原文链接:http://blog.csdn.net/f_zongjian/article/details/24144803 本机OS X:10.9,未安装XCode, ...

  9. ErrorCode枚举类型返回错误码信息测试,手动抛出异常信息,在事务中根据错误码来回滚事务的思路。

    ErrorCode.java 简单测试代码,具体应用思路:手动抛出异常信息,在事务中根据错误码来回滚事务的思路. public enum ErrorCode { //系统级 SUCCESS(" ...

  10. (转) C++ static、const和static const 以及它们的初始化

    const定义的常量在超出其作用域之后其空间会被释放,而static定义的静态常量在函数执行后不会释放其存储空间. static表示的是静态的.类的静态成员函数.静态成员变量是和类相关的,而不是和类的 ...