简单的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; ; }