[JAVA] ABC - 015 - A & B & C.

AtCoder ABC 015 A&B&C AtCoder - 015

A --Takahashi-kuns Training

――Variable Namen haben für jedes Unternehmen eindeutige Regeln.

	private void solveA() {
		String a = next();
		String b = next();

		out.println(a.length() > b.length() ? a : b);
	}

B - Takahashi-kuns Summe

	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 - Takahashi-kuns Fehlersuche

――Es war eine ziemlich typische DFS

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) {

		/*
		 *Ich habe die letzte Frage erreicht, überprüfen Sie also die bisherigen Ergebnisse von XOR
		 */
		if (currentI >= wk.length) {
			return currenXor == 0;
		}
		boolean res = false;
		/*
		 *Überprüfen Sie das XOR, wenn Sie die i-te Auswahl der aktuellen i-ten Frage auswählen
		 */
		for (int i = 0; i < wk[currentI].length; i++) {
			res = res || recursiveC(wk, currentI + 1, currenXor ^ wk[currentI][i]);
		}

		return res;
	}

Recommended Posts

ABC - 013-A & B & C.
ABC - 023 - A & B & C.
ABC - 036-A & B & C.
ABC - 010 - A & B & C.
ABC - 028 - A & B & C.
ABC - 015 - A & B & C.
ABC - 128 - A & B & C.
ABC - 012-A & B & C.
ABC - 018 - A & B & C.
ABC - 054 - A & B & C.
ABC - 017 - A & B & C.
ABC - 029 - A & B & C.
ABC - 022 - A & B & C.
ABC - 019 - A & B & C.
ABC - 020 - A & B & C.
ABC - 030 - A & B & C.
ABC - 127 - A & B & C.
ABC - 007 - A & B & C.
ABC - 132 - A & B & C.
ABC - 026 - A & B & C.
ABC - 014 - A & B & C.
ABC - 016 - A & B & C.
ABC - 011-A & B & C.
ABC - 031 - A & B & C.
ABC - 021 - A & B & C.
ABC - 025 - A & B & C.
ABC - 024 - A & B & C.
ABC - 027 - A & B & C.
ABC - 080 - A & B & C.
ABC - 129 - A & B & C & D.
ABC - 133 - A & B & C & D.
ABC - 122 - A & B & C & D.
ABC - 125 - A & B & C & D.
ABC - 130 - A & B & C & D.
ABC - 126 - A & B & C & D.
ABC - 134 - A & B & C & D & E.
ABC - 131 - A & B & C & D & E.
diverta 2019 Programmierwettbewerb A & B & C & D.
AtCoder Anfängerwettbewerb 169 A, B, C mit Rubin
atcoder ABC113 C Problem
ABC093 C - Gleiche Ganzzahlen
atcoder ABC115 C Problem
AtCoder Anfängerwettbewerb 170 A, B, C bis Rubin
Eine Person, die C ++ schreibt, hat versucht, Java zu schreiben
Machen Sie einen SOAP-Aufruf in C #
Rufen Sie C-Sprachfunktionen von Swift aus auf
NLP4J 100 Sprachverarbeitungsklopfen mit NLP4J # 34 "A B"