This commit is contained in:
2025-12-28 21:05:06 +08:00
parent 5d09b15326
commit bdaedc135e
46 changed files with 485 additions and 38 deletions
@@ -0,0 +1,41 @@
import java.util.Scanner;
public class P2857 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] mention = new int[101];
boolean[][] by = new boolean[101][101];
for (int i = 0; i < n; i++) {
int sender = in.nextInt();
int k = in.nextInt();
for (int j = 0; j < k; j++) {
int id = in.nextInt();
if (id >= 0 && id <= 100) {
mention[id]++;
if (sender >= 0 && sender <= 100) by[id][sender] = true;
}
}
}
int bestId = 0;
int bestCount = -1;
for (int id = 0; id <= 100; id++) {
if (mention[id] > bestCount) {
bestCount = mention[id];
bestId = id;
}
}
System.out.println(bestId);
StringBuilder sb = new StringBuilder();
boolean first = true;
for (int s = 0; s <= 100; s++) {
if (by[bestId][s]) {
if (!first) sb.append(' ');
sb.append(s);
first = false;
}
}
System.out.println(sb.toString());
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

@@ -0,0 +1,17 @@
import java.util.*;
public class P2840 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<Integer> nums = new ArrayList<>();
while (in.hasNextInt()) nums.add(in.nextInt());
Collections.sort(nums);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < nums.size(); i++) {
if (i > 0) sb.append(' ');
sb.append(nums.get(i));
}
System.out.println(sb.toString());
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

@@ -0,0 +1,25 @@
import java.util.*;
public class P1098 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<Integer> a = new ArrayList<>();
while (in.hasNextInt()) a.add(in.nextInt());
StringBuilder first = new StringBuilder();
StringBuilder second = new StringBuilder();
boolean f = true;
for (int i = 0; i < a.size(); i++) {
if ((i & 1) == 0) {
if (!f) first.append(' ');
first.append(a.get(i));
f = false;
} else {
if (second.length() > 0) second.append(' ');
second.append(a.get(i));
}
}
System.out.println(first.toString());
System.out.println(second.toString());
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB