static Set<String> ans = new HashSet<>();
public static void main(String[] args) throws IOException {
solution("", 2, 0, 0);
System.out.println(ans.size());
}
static void solution(String path, int booze, int store, int flower) {
if (booze == 0 && flower == 10 && store ==5) {
ans.add(path);
} else if (booze <= 0 || flower > 10 || store > 5) {
} else {
solution(path + "b", booze - 1, store, flower + 1);
solution(path + "a", booze * 2, store + 1, flower);
}
}
0 回复
0 转发
0 喜欢
5 阅读



