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

AtCoder ABC 036 A&B&C AtCoder - 036

2019/05/27 Korrektur des Problemnamens

Ein Tee

-Wenn nur $ b \ div a $ abgerundet wird, kaufen Sie eine zusätzliche Box, wenn $ b % a $ größer als 0 ist

	private void solveA() {
		int a = nextInt();
		int b = nextInt();

		out.println((b / a) + (b % a > 0 ? 1 : 0));
	}

B-Rotation

	private void solveB() {
		int numN = nextInt();
		char[][] wk = IntStream.range(0, numN).collect(() -> new char[numN][numN],
				(t, i) -> {
					t[i] = next().toCharArray();
				}, (t, u) -> {
					Stream.concat(Arrays.stream(t), Arrays.stream(u));
				});

		for (int j = 0; j < numN; j++) {
			StringBuilder builder = new StringBuilder();
			for (int k = numN - 1; k >= 0; k--) {
				builder.append(wk[k][j]);
			}
			out.println(builder.toString());
		}
	}

C-Sitzdruck

Das Ergebnis der Komprimierung ist wie folgt (Gefühl, dass nur die Größenbeziehung beibehalten wird)

3 3 1 6 1 -> 1 1 0 2 0
3 3 1 90 1 -> 1 1 0 2 0
9 9 1 10 1 -> 1 1 0 2 0
9 9 5 10 5 -> 1 1 0 2 0

--Sort 1,3,6.

3 3 1 6 1 -> 1 1 3 3 6

―― 1 erscheint zuerst ―― 3 erscheint an zweiter Stelle ―― 6 erscheint an dritter Stelle

Da es das kleinste ist, ersetzen Sie das erste Vorkommen durch das 0. und geben Sie die Zahl aus, in der $ a_i $ erscheint.

3 3 1 6 1 -> 1 1 0 2 0
	private void solveC() {
		int numN = nextInt();
		int[] wk = new int[numN];
		Set<Integer> wkL = new HashSet<Integer>();
		for (int i = 0; i < wk.length; i++) {
			wk[i] = nextInt();
			wkL.add(wk[i]);
		}

		List<Integer> tmp = new ArrayList<Integer>();
		tmp.addAll(wkL);
		Collections.sort(tmp);

		for (int i = 0; i < wk.length; i++) {
			int position = Collections.binarySearch(tmp, wk[i]);
			position = position >= 0 ? position : ~position;
			out.println(position);
		}
	}

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"