第一次碰到博弈论题目,是很棘手,博弈论题目要考虑全局最优的解法,我第一次用了局部最优的,而且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. discuz之同步登入

    前言   首先感谢dozer学长吧UCenter翻译成C# 博客地址----------->http://www.dozer.cc/   其次感谢群友快乐々止境同学的热心指导,虽然萍水相逢但让我 ...

  2. 【BZOJ】【2668】【CQOI2012】交换棋子

    网络流/费用流 跪跪跪,居然还可以这样建图…… 题解:http://www.cnblogs.com/zig-zag/archive/2013/04/21/3033485.html 考虑每个点的交换限制 ...

  3. Leetcode#140 Word Break II

    原题地址 动态规划题 令s[i..j]表示下标从i到j的子串,它的所有分割情况用words[i]表示 假设s[0..i]的所有分割情况words[i]已知.则s[0..i+1]的分割情况words[i ...

  4. max_flow(Edmond_Karp) 分类: ACM TYPE 2014-09-02 10:47 92人阅读 评论(0) 收藏

    #include <cstdio> #include <iostream> #include <cstring> #include<queue> usi ...

  5. 【转载】c/c++在windows下获取时间和计算时间差的几种方法总结

    一.标准C和C++都可用 1.获取时间用time_t time( time_t * timer ),计算时间差使用double difftime( time_t timer1, time_t time ...

  6. Phyre LCUE with YEBIS cause issues about GS

    when LCUE enabled in phyreEngine when Yebis integrated and render there are two mainloopdraws in one ...

  7. 监听HTML input输入框值的即时变化onpropertychange、oninput兼容IE,Chrome,FF,Opera等

    转自:http://blog.csdn.net/itchiang/article/details/7769337 要达到的效果 很多情况下我们都会即时监听输入框值的变化,以便作出即时动作去引导浏览者增 ...

  8. 4-Highcharts 3D图之3D普通饼图

    <!DOCTYPE> <html lang='en'> <head> <title>4-Highcharts 3D图之3D普通饼图</title& ...

  9. HDOJ 1226 超级密码

    超级密码 Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  10. 13test02:信用卡校验

    /*#include<iostream> using namespace std; void input(); int counter=0,jishu_sum=0,oushu_sum=0, ...