题目:http://acm.hdu.edu.cn/showproblem.php?pid=2575
AC代码(C++):
#include <iostream> #include <queue> #include <vector> #include <set> #include <string> #include <algorithm> #include <string.h> #include <math.h> #define INF 0x3f3f3f3f #define eps 1e-8 typedef unsigned long long ull; typedef long long ll; using namespace std; int solve(int d) { int rtn = 1; for (int i = 1; i <= d / 2; i++) { rtn += solve(i); } return rtn; } int main() { int t; cin >> t; while (t--) { char n[50]; cin >> n; int tmp = n[0] - '0'; cout << solve(tmp) << endl; } //system("pause"); }总结: 简单的深搜.