AtCoder ABC 015 A&B&C AtCoder - 015
―― Les noms de variables ont des règles uniques pour chaque entreprise.
	private void solveA() {
		String a = next();
		String b = next();
		out.println(a.length() > b.length() ? a : b);
	}
	private void solveB() {
		int n = nextInt();
		double base = 0;
		double total = 0;
		for (int i = 0; i < n; i++) {
			int wk = nextInt();
			if (wk != 0) {
				base++;
				total += wk;
			}
		}
		out.println((int) Math.ceil(total / base));
	}
―― C'était un DFS assez typique
private void solveC() {
		int n = nextInt();
		int k = nextInt();
		int[][] wk = IntStream.range(0, n).collect(() -> new int[n][k],
				(t, i) -> {
					for (int j = 0; j < k; j++) {
						t[i][j] = nextInt();
					}
				},
				(t, u) -> {
					Stream.concat(Arrays.stream(t), Arrays.stream(u));
				});
		out.println(recursiveC(wk, 0, 0) ? "Found" : "Nothing");
	}
	private boolean recursiveC(int[][] wk, int currentI, int currenXor) {
		/*
		 *J'ai atteint la dernière question, alors vérifiez les résultats de XOR jusqu'à présent
		 */
		if (currentI >= wk.length) {
			return currenXor == 0;
		}
		boolean res = false;
		/*
		 *Vérifiez le XOR lors de la sélection de la i-ème sélection de la I-ème question actuelle
		 */
		for (int i = 0; i < wk[currentI].length; i++) {
			res = res || recursiveC(wk, currentI + 1, currenXor ^ wk[currentI][i]);
		}
		return res;
	}
        Recommended Posts