简单的dfs题目

 /*
 ID: yingzho1
 LANG: C++
 TASK: rockers
 */
 #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("rockers.in");
 ofstream fout("rockers.out");

 int N, T, M;
 ];
 ;

 void dfs(int leftvol, int diskdep, int songdep, int recsong) {
     if (diskdep == M) {
         maxnum = max(maxnum, recsong);
         return;
     }
     if (songdep == N) {
         maxnum = max(maxnum, recsong);
         return;
     }
     , recsong+);
     , songdep, recsong);
     dfs(leftvol, diskdep, songdep+, recsong);
 }

 int main()
 {
     fin >> N >> T >> M;
     ; i < N; i++) fin >> songs[i];
     dfs(T, , , );
     fout << maxnum << endl;

     ;
 }

USACO Section 3.4: Raucous Rockers的更多相关文章

  1. USACO 3.4 Raucous Rockers

    Raucous Rockers You just inherited the rights to N (1 <= N <= 20) previously unreleased songs ...

  2. 洛谷P2736 “破锣摇滚”乐队 Raucous Rockers

    P2736 "破锣摇滚"乐队 Raucous Rockers 21通过 52提交 题目提供者该用户不存在 标签USACO 难度普及+/提高 提交  讨论  题解 最新讨论 暂时没有 ...

  3. 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&& ...

  4. P2736 “破锣摇滚”乐队 Raucous Rockers

    题目描述 你刚刚继承了流行的“破锣摇滚”乐队录制的尚未发表的N(1 <= N <= 20)首歌的版权.你打算从中精选一些歌曲,发行M(1 <= M <= 20)张CD.每一张C ...

  5. USACO Section 3.3: Riding the Fences

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

  6. USACO Section 3.3 Camlot(BFS)

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

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

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

  8. 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 ...

  9. USACO Section 1.3 Prime Cryptarithm 解题报告

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

随机推荐

  1. 不会JS中的OOP,你也太菜了吧!(第一篇)

    一.你必须知道的 1) 字面量 2) 原型 3) 原型链 4) 构造函数 5) 稳妥对象(没有公共属性,而且其方法也不引用this的对象.稳妥对象适合用在安全的环境中和防止数据被其它程序改变的时候) ...

  2. Careercup - Microsoft面试题 - 5943729928011776

    2014-05-10 21:56 题目链接 原题: Suppose you get number of unique users every second from bing For eg, ,,,, ...

  3. jekyll : 使用github托管你的博客

    使用github托管你的博客 效果: http://wuya1234.github.io/blog/2013/11/09/start-github-blog/ 样式神马的还没整 电脑系统 我使用的是m ...

  4. 菜鸟搭建Android环境~~~~绝对靠谱

    因为要测试移动设备.搭建了一下Android环境 这是菜鸟级别的安装 因为sdk版本,eclipse版本,adt版本各自有版本要求,所以我选择都去官网下载新版本,这样总不会出现版本兼容性问题了吧~~ ...

  5. 1. ProGit-起步

    (1) 版本控制 本地式 大都是采用数据库记录文件的差异 典型的有rcs,主要保存并管理文件补丁,根据补丁去计算各版本文件内容 缺点:无法协同工作 集中式 通过一个单一的集中服务器去管理所有文件的修订 ...

  6. idea新建项目完整过程

    参看下面博客 http://www.cnblogs.com/cnjava/archive/2013/01/29/2881654.html 突然,感觉idea其实挺麻烦的: 一.junit test做起 ...

  7. CHtml::radioButtonList

    public function getSortList(){ $arr = array(); $arr[0]['id']=0; $arr[0]['name']="否"; $arr[ ...

  8. [工作积累] error: bad class file magic (cafebabe) or version (0033.0000)

    Update Android SDK build tool to latest can solve my problem.

  9. AS3之正则表达式讲解

    限制输入内容 (一).my_txt.restrict = "A-Z 0-9";               仅允许在文本字段中输入大写字符.空格和数字 (二).my_txt.res ...

  10. 一些实用的 jQuery 技巧

    jQuery如今已经成为Web开发中最流行的JavaScript库,通过jQuery和大量的插件,你可以轻松实现各种绚丽的效果. 本文将为你介绍一些实用的技巧,希望可以帮助你更加高效地使用jQuery ...