AtCoder ABC 028 A&B&C AtCoder - 028
Subtilement A-C est une série de temps simples. .. ..
** PostScript 03/05/2019 ** Correction du code du problème B
private void solveA() {
int numN = nextInt();
if (numN <= 59) {
out.println("Bad");
} else if (numN <= 89) {
out.println("Good");
} else if (numN <= 99) {
out.println("Great");
} else {
out.println("Perfect");
}
}
** 2019/05/03 Correction de code **
private void solveB() {
String wk = next();
Map<String, Long> tmp = Arrays.stream(wk.split(""))
.collect(Collectors.groupingBy(s -> s, Collectors.counting()));
String[] ref = { "A", "B", "C", "D", "E", "F" };
String res = Arrays.stream(ref).map(i -> tmp.getOrDefault(i, 0L)
.toString()).collect(Collectors.joining(" "));
/*
*Ce problème est coupé car ce sera WA s'il y a un blanc à la fin
*/
out.println(res.trim());
}
private void solveC2() {
int[] wk = IntStream.range(0, 5).map(i -> nextInt()).toArray();
Set<Integer> set = new TreeSet<Integer>();
for (int i = 0; i < wk.length; i++) {
for (int j = i + 1; j < wk.length; j++) {
for (int k = j + 1; k < wk.length; k++) {
set.add(wk[i] + wk[j] + wk[k]);
}
}
}
List<Integer> list = new ArrayList<Integer>(set);
out.println(list.get(list.size() - 3));
}
-Si $ a <b <c <d <e $
--La valeur maximale est
-
private void solveC() {
int[] wk = IntStream.range(0, 5).map(i -> nextInt()).toArray();
int res = Integer.max(wk[4] + wk[3]+ wk[0], wk[4] + wk[2]+ wk[1]);
out.println(res);
}
Recommended Posts