更新
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2989 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
int n = in.nextInt();
|
||||
for (int i = 0; i < n; i++) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int j = 0; j < n; j++) sb.append('V');
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@@ -0,0 +1,39 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2975 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
StringBuilder all = new StringBuilder();
|
||||
if (in.hasNextLine()) {
|
||||
all.append(in.nextLine());
|
||||
while (in.hasNextLine()) {
|
||||
all.append('\n');
|
||||
all.append(in.nextLine());
|
||||
}
|
||||
}
|
||||
Map<Character, Integer> cnt = new HashMap<>();
|
||||
for (int i = 0; i < all.length(); i++) {
|
||||
char c = all.charAt(i);
|
||||
if (c == '\r' || c == '\n') continue;
|
||||
cnt.put(c, cnt.getOrDefault(c, 0) + 1);
|
||||
}
|
||||
char bestChar = 0;
|
||||
int best = -1;
|
||||
for (Map.Entry<Character, Integer> e : cnt.entrySet()) {
|
||||
char c = e.getKey();
|
||||
int v = e.getValue();
|
||||
if (v > best || (v == best && c < bestChar)) {
|
||||
best = v;
|
||||
bestChar = c;
|
||||
}
|
||||
}
|
||||
if (best < 0) {
|
||||
System.out.println();
|
||||
System.out.println(0);
|
||||
} else {
|
||||
System.out.println(bestChar);
|
||||
System.out.println(best);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@@ -0,0 +1,18 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2977 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
if (!in.hasNextInt()) { in.close(); return; }
|
||||
int n = in.nextInt();
|
||||
int[] a = new int[n];
|
||||
for (int i = 0; i < n; i++) a[i] = in.nextInt();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (i > 0) sb.append(' ');
|
||||
sb.append(a[i] + 1);
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
Reference in New Issue
Block a user