简单的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. 不同系统平台下Java默认的安装路径

    下面以Oracle的JDK7update 51为例: • 32-bit JDK on Windows: C:\Program Files (x86)\Java\jdk1.7.0_51 • 64-bit ...

  2. 01.Hibernate入门

    前言:本文用一个简单的Hibernate应用程序例子来引领初学者入门,让初学者对Hibernate的使用有一个大致的认识.本文例子使用了MySQL数据库.Maven管理工具.Eclipse开发工具,创 ...

  3. 【BZOJ】【3157】&【BZOJ】【3516】国王奇遇记

    数论 题解:http://www.cnblogs.com/zhuohan123/p/3726933.html copy一下推导过程: 令$$S_i=\sum_{k=1}^{n}k^im^k$$ 我们有 ...

  4. Matlab中diag函数注意事项

    在给李X写SVD代码的时候注意到的. >> a = magic(3) a = 8 1 6 3 5 7 4 9 2 >> diag(a) ans = 8 5 2 >> ...

  5. Java/Java Web中乱码解决汇总

    在开发Java/Java Web Application过程中,往往会出现乱码问题,而且有的时候真会弄得人很烦,浪费太多的时间. 记得之前看过一篇帖子,详细解释了Encoding/Decoding过程 ...

  6. JAVA 关于Icon,Image,ImageIcon的简单的对比参考 分类: Java Game 2014-08-14 17:08 210人阅读 评论(0) 收藏

    转自:http://blog.csdn.net/bcmissrain/article/details/7190886 其实就算是现在,我还是有不少地方概念模糊,但是下面的内容是是没有什么问题的.稍微介 ...

  7. Codeforces Round #204 (Div. 2)->B. Jeff and Periods

    B. Jeff and Periods time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. Java正则表达式匹配例子

    Java正则表达式匹配例子 package com.ibm.test; import java.util.regex.Matcher; import java.util.regex.Pattern; ...

  9. Sqli-labs less 33

    Less-33 本关和上一关的payload是一样的 http://127.0.0.1/sqli-labs/Less-33/?id=-1%df%27union%20select%201,user(), ...

  10. c++11 内存模型解读

    c++11 内存模型解读 关于乱序 说到内存模型,首先需要明确一个普遍存在,但却未必人人都注意到的事实:程序通常并不是总按着照源码中的顺序一一执行,此谓之乱序,乱序产生的原因可能有好几种: 编译器出于 ...