第一题记忆化搜索为啥直接是0% 鼠鼠我直接自闭了import java.util.*;// 注意类名必须为 Main, 不要有任何 package xxx 信息public class Main { public static int a, b, c; public static boolean[] vis = new boolean[105]; public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); Arrays.fill(vis, true); while (t > 0) { t--; int n, m, k; a = 0; b = 0; c = 0; n = in.nextInt(); m = in.nextInt(); k = in.nextInt(); boolean res = dfs(100, n, m, k); if (res) { System.out.println("YES"); System.out.println(a + " " + b + " " + c); } else { System.out.println("NO"); } } } public static boolean dfs(int goal, int n, int m, int k) { boolean f1 = false; boolean f2 = false; boolean f3 = false; if(!vis[goal]){ return false; } if (goal == 0) { return true; } if (goal > 0 && goal vis[goal] = false; return false; } if (goal >= n && n > 0) { a++; f1 = dfs(goal - n, n, m, k); if (f1) { return true; } else { a--; } } if (goal >= m && m > 0) { b++; f2 = dfs(goal - m, n, m, k); if (f2) { return true; } else { b--; } } if (goal >= k && k > 0) { c++; f3 = dfs(goal - k, n, m, k); if (f3) { return true; } else { c--; } } vis[goal] = false; return false; }}