Nâng cấp máy tính (Thuật toán quay lui)
package Advance; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; public class ComputerUpgrade { int N, M; int Answer; int Package[][]; int Value[]; int visit[]; int Subset[]; int SLM; int min; public static void main(String[] args) throws Exception { new ComputerUpgrade().begin(); } private void begin() throws Exception { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int test_case = 1; test_case <= T; test_case++) { Answer = 0; N = sc.nextInt(); Package = new int[51][51]; Value = new int[51]; min = 100000000; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (i == j) { Package[i][j] = 1; Value[i] = sc.nextInt(); } } } M = sc.nextInt(); for (int i = N + 1; i <= M + N; i++) { Value[i] = sc.nextInt(); int sl = sc.nextInt(); for (int j = 0; j < sl; j++) { int i...