AtCoder ABC 036 A&B&C AtCoder - 036
2019/05/27 Correction du nom du problème
-Si seulement $ b \ div a $ est arrondi, achetez une boîte supplémentaire si $ b % a $ est supérieur à 0
	private void solveA() {
		int a = nextInt();
		int b = nextInt();
		out.println((b / a) + (b % a > 0 ? 1 : 0));
	}
	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());
		}
	}
--Il semble que la méthode soit la ** compression de coordonnées **
Le résultat de la compression est le suivant (sentiment que seule la relation d'amplitude est conservée)
| 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 | 
| 3 | 3 | 1 | 6 | 1 | -> | 1 | 1 | 3 | 3 | 6 | 
―― 1 apparaît en premier ―― 3 apparaît en deuxième ―― 6 apparaît troisième
Puisqu'il s'agit de la plus petite, remplacez la première occurrence par le 0 et affichez le nombre où $ a_i $ apparaît.
| 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