バックトラックして頭から作っていく。
vector<string> ret;
char buff[100];
void bt(int n, const int N)
{
if (n <= N) ; else return ;
if (ret.size() < 50) {
if (n) {
sprintf(buff, "%d.mp3", n);
ret.push_back(string(buff));
}
for (int i = 1 - (bool)n; i <= 9; ++i) {
bt(n * 10 + i, N);
}
}
return ;
}
class FoxAndMp3 {
public:
vector <string> playList(int n)
{
ret.clear();
bt(0, n);
return ret;
}
};