目錄

引言
邊吃飯邊做題,新鮮的題目詳解,雖然所有學校的考試時間都不一樣,不過本文是在考試剛結束就開始編寫了,對我來說是brandnew的。
這是我去年寫的博客,今年又出現不少原題:
去年原題部分
結果填空
1. 簽到題
問題描述
在計算機存儲中,15.125GB是多少MB?
答案提交
這是一道結果填空的題,你只需要算出結果后提交即可。本題的結果為一個整數,在提交答案時只填寫這個整數,填寫多余的內容將無法得分。
題解:
計算器按一下就好了。
15488
2. 概念題
問題描述
1200000有多少個約數(只計算正約數)。
答案提交
這是一道結果填空的題,你只需要算出結果后提交即可。本題的結果為一個整數,在提交答案時只填寫這個整數,填寫多余的內容將無法得分。
題解:
被這題卡住,需要谷歌一下約數的概念。
96
3. 簽到題
問題描述
一棵包含有2019個結點的樹,最多包含多少個葉結點?
答案提交
這是一道結果填空的題,你只需要算出結果后提交即可。本題的結果為一個整數,在提交答案時只填寫這個整數,填寫多余的內容將無法得分。
題解:
2018叉樹不就是2018個葉節點,說來想起我課設寫的好像是個類三叉樹。
2018
4. 簽到題
問題描述
在1至2019中,有多少個數的數位中包含數字9?
注意,有的數中的數位中包含多個9,這個數只算一次。例如,1999這個數包含數字9,在計算只是算一個數。
答案提交
這是一道結果填空的題,你只需要算出結果后提交即可。本題的結果為一個整數,在提交答案時只填寫這個整數,填寫多余的內容將無法得分。
題解:
簽到題,從這一題開始寫了代碼。
544
很簡單的代碼。
public class M2020T4 {
static boolean contain9(int num) {
while (num != 0) {
if (num % 10 == 9) {
return true;
} else {
num /= 10;
}
}
return false;
}
public static void main(String[] args) {
int count = 0;
for (int i = 1; i <= 2019; i++) {
if (contain9(i)) {
count++;
}
}
System.out.println(count);
}
}
程序題
5. 遞增三元組[遍歷]
去年原題,接着暴力玩,其實可以最長上升子序列之類的做法。
問題描述
在數列 a[1], a[2], ..., a[n] 中,如果對於下標 i, j, k 滿足 0<i<j<k<n+1 且 a[i]<a[j]<a[k],則稱 a[i], a[j], a[k] 為一組遞增三元組,a[j]為遞增三元組的中心。
給定一個數列,請問數列中有多少個元素可能是遞增三元組的中心。
輸入格式
輸入的第一行包含一個整數 n。
第二行包含 n 個整數 a[1], a[2], ..., a[n],相鄰的整數間用空格分隔,表示給定的數列。
輸出格式
輸出一行包含一個整數,表示答案。
樣例輸入
5
1 2 5 3 5
樣例輸出
2
樣例說明
a[2] 和 a[4] 可能是三元組的中心。
評測用例規模與約定
對於 50% 的評測用例,2 <= n <= 100,0 <= 數列中的數 <= 1000。
對於所有評測用例,2 <= n <= 1000,0 <= 數列中的數 <= 10000。
題解:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class M2020T5 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("5\n" +
// "1 2 5 3 5"));
reader.readLine();
String[] split = reader.readLine().split(" ");
int[] a = new int[split.length];
for (int i = 0; i < split.length; i++) {
a[i] = Integer.parseInt(split[i]);
}
int count = 0;
for (int i = 0; i < a.length; i++) {
for (int j = i + 1; j < a.length; j++) {
for (int k = j + 1; k < a.length; k++) {
if (a[i] < a[j] && a[j] < a[k]) {
a[j] = Integer.MAX_VALUE;
count++;
}
}
}
}
System.out.println(count);
}
}
6. 小明的hello[循環]
考察substring的用法?
問題描述
小明對類似於 hello 這種單詞非常感興趣,這種單詞可以正好分為四段,第一段由一個或多個輔音字母組成,第二段由一個或多個元音字母組成,第三段由一個或多個輔音字母組成,第四段由一個或多個元音字母組成。
給定一個單詞,請判斷這個單詞是否也是這種單詞,如果是請輸出yes,否則請輸出no。
元音字母包括 a, e, i, o, u,共五個,其他均為輔音字母。
輸入格式
輸入一行,包含一個單詞,單詞中只包含小寫英文字母。
輸出格式
輸出答案,或者為yes,或者為no。
樣例輸入
lanqiao
樣例輸出
yes
樣例輸入
world
樣例輸出
no
評測用例規模與約定
對於所有評測用例,單詞中的字母個數不超過100。
題解:
讓我們輕松給出直接正則的做法:
^([bcdfghjklmnpqrstvwxyz]+)([aeiou]+)([bcdfghjklmnpqrstvwxyz]+)([aeiou]+)$
好了上面的如果想不出來,我們還有正常做法:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class M2020T6 {
static char[] yuan = {'a', 'e', 'i', 'o', 'u'};
static boolean checkYuan(char input) {
for (char c : yuan) {
if (input == c) {
return true;
}
}
return false;
}
static boolean check(String input) {
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
boolean flag4 = false;
while (!checkYuan(input.charAt(0))) {
flag1 = true;
input = input.substring(1);
if (input.equals("")) {
return false;
}
}
if (!flag1) {
return false;
}
while (checkYuan(input.charAt(0))) {
flag2 = true;
input = input.substring(1);
if (input.equals("")) {
return false;
}
}
if (!flag2) {
return false;
}
while (!checkYuan(input.charAt(0))) {
flag3 = true;
input = input.substring(1);
if (input.equals("")) {
return false;
}
}
if (!flag3) {
return false;
}
while (checkYuan(input.charAt(0))) {
flag4 = true;
input = input.substring(1);
if (input.equals("")) {
return true;
}
}
if (!flag4) {
return false;
}
if (checkYuan(input.charAt(0))) {
flag1 = false;
}
return flag1;
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("lanqiao"));
String input = reader.readLine();
if (check(input)) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
7. 數位遞增[數位dp]
自己想了暴力,但是能看出來有很大優化空間,然后找到了數位dp。
問題描述
一個正整數如果任何一個數位不大於右邊相鄰的數位,則稱為一個數位遞增的數,例如1135是一個數位遞增的數,而1024不是一個數位遞增的數。
給定正整數 n,請問在整數 1 至 n 中有多少個數位遞增的數?
輸入格式
輸入的第一行包含一個整數 n。
輸出格式
輸出一行包含一個整數,表示答案。
樣例輸入
30
樣例輸出
26
評測用例規模與約定
對於 40% 的評測用例,1 <= n <= 1000。
對於 80% 的評測用例,1 <= n <= 100000。
對於所有評測用例,1 <= n <= 1000000。
題解:
給一套騷操作。
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class M2020T7 {
public static int n = 0, count = 0;
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("30"));
n = Integer.parseInt(reader.readLine());
check(0, 1);
System.out.println(count - 1);
}
private static void check(int num, int temp) {
if (num > n) {
return;
} else {
count++;
}
for (int i = temp; i < 10; i++) {
check(num * 10 + i, i);
}
}
}
8. 小明家的草地[bfs]
bfs,不過我選擇暴力(。
問題描述
小明有一塊空地,他將這塊空地划分為 n 行 m 列的小塊,每行和每列的長度都為 1。
小明選了其中的一些小塊空地,種上了草,其他小塊仍然保持是空地。
這些草長得很快,每個月,草都會向外長出一些,如果一個小塊種了草,則它將向自己的上、下、左、右四小塊空地擴展,這四小塊空地都將變為有草的小塊。
請告訴小明,k 個月后空地上哪些地方有草。
輸入格式
輸入的第一行包含兩個整數 n, m。
接下來 n 行,每行包含 m 個字母,表示初始的空地狀態,字母之間沒有空格。如果為小數點,表示為空地,如果字母為 g,表示種了草。
接下來包含一個整數 k。
輸出格式
輸出 n 行,每行包含 m 個字母,表示 k 個月后空地的狀態。如果為小數點,表示為空地,如果字母為 g,表示長了草。
樣例輸入
4 5
.g...
.....
..g..
.....
2
樣例輸出
gggg.
gggg.
ggggg
.ggg.
評測用例規模與約定
對於 30% 的評測用例,2 <= n, m <= 20。
對於 70% 的評測用例,2 <= n, m <= 100。
對於所有評測用例,2 <= n, m <= 1000,1 <= k <= 1000。
題解:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class M2020T8 {
static void print(boolean[][] ground) {
StringBuilder result = new StringBuilder();
for (boolean[] booleans : ground) {
for (boolean aBoolean : booleans) {
if (aBoolean) {
result.append('g');
} else {
result.append('.');
}
}
result.append('\n');
}
System.out.print(result);
}
static boolean[][] clone(boolean[][] ground) {
boolean[][] result = new boolean[ground.length][ground[0].length];
for (int i = 0; i < ground.length; i++) {
System.arraycopy(ground[i], 0, result[i], 0, ground[i].length);
}
return result;
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("4 5\n" +
// ".g...\n" +
// ".....\n" +
// "..g..\n" +
// ".....\n" +
// "2"));
String[] split = reader.readLine().split(" ");
int n = Integer.parseInt(split[0]);
int m = Integer.parseInt(split[1]);
boolean[][] ground = new boolean[n][m];
for (int i = 0; i < n; i++) {
String line = reader.readLine();
for (int j = 0; j < m; j++) {
char ch = line.charAt(j);
if (ch == 'g') {
ground[i][j] = true;
}
}
}
int k = Integer.parseInt(reader.readLine());
for (int i = 0; i < k; i++) {
boolean[][] tmp = clone(ground);
for (int j = 0; j < n; j++) {
for (int l = 0; l < m; l++) {
if (tmp[j][l]) {
if (j > 0) {
ground[j - 1][l] = true;
}
if (j < n - 1) {
ground[j + 1][l] = true;
}
if (l > 0) {
ground[j][l - 1] = true;
}
if (l < m - 1) {
ground[j][l + 1] = true;
}
}
}
}
}
print(ground);
}
}
9. 小明的正整數序列[dfs]
這題把我卡住了。
是一道dfs,用數組記憶一下已有的結果,這題跟學長討論的結果是沒辦法只用一次dfs實現,因為初始的結束條件與接下來的結束條件不一致,我就卡在了這。
問題描述
小明想知道,滿足以下條件的正整數序列的數量:
1. 第一項為 n;
2. 第二項不超過 n;
3. 從第三項開始,每一項小於前兩項的差的絕對值。
請計算,對於給定的 n,有多少種滿足條件的序列。
輸入格式
輸入一行包含一個整數 n。
輸出格式
輸出一個整數,表示答案。答案可能很大,請輸出答案除以10000的余數。
樣例輸入
4
樣例輸出
7
樣例說明
以下是滿足條件的序列:
4 1
4 1 1
4 1 2
4 2
4 2 1
4 3
4 4
評測用例規模與約定
對於 20% 的評測用例,1 <= n <= 5;
對於 50% 的評測用例,1 <= n <= 10;
對於 80% 的評測用例,1 <= n <= 100;
對於所有評測用例,1 <= n <= 1000。
題解:
我們可以用小學二年級知識輕松口算出時間復雜度O(1)的代碼:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
public class M2020T9 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
reader = new BufferedReader(new StringReader("4"));
int n = Integer.parseInt(reader.readLine());
int[] ans = {0, 1, 2, 4, 7, 14, 26, 53, 106, 220, 452, 946, 1967, 4128, 8638, 8144, 8068, 26, 8127, 3542, 3277, 3278, 7643, 5433, 5774, 8217, 4846, 687, 3097, 6887, 3556, 4840, 3454, 5378, 722, 2230, 767, 1447, 1839, 4776, 7618, 7831, 6222, 5236, 7802, 5696, 1835, 1102, 9537, 1605, 1227, 3034, 2159, 1613, 6811, 3941, 6794, 5960, 4903, 75, 2158, 349, 4258, 5189, 4717, 2894, 4193, 2890, 258, 2928, 6125, 2913, 1482, 8419, 7244, 1652, 3440, 2138, 9272, 4714, 3333, 3543, 8834, 6763, 9180, 1803, 4631, 6307, 9056, 3170, 8339, 6213, 1176, 3258, 272, 4257, 1893, 8020, 3682, 9531, 6961, 4145, 3086, 3455, 9057, 1346, 5768, 6907, 247, 2450, 4732, 8653, 8229, 842, 3346, 9671, 7106, 3561, 4952, 9539, 1791, 6208, 6083, 8838, 7474, 6854, 198, 7300, 8219, 5912, 8884, 3976, 9650, 4821, 7317, 9720, 5572, 3834, 6326, 2281, 34, 8409, 28, 445, 8155, 9846, 9944, 2504, 3954, 1639, 7243, 8502, 6926, 1609, 7449, 3769, 5695, 6683, 7531, 6275, 5827, 6184, 1982, 736, 9718, 2777, 7688, 6626, 7456, 961, 5556, 7573, 6886, 4543, 3957, 2859, 4666, 9795, 305, 9052, 5350, 9827, 5445, 6970, 2599, 7566, 2848, 2987, 5179, 1537, 2392, 6375, 9621, 7376, 3301, 1357, 6545, 7838, 9390, 4284, 2631, 1814, 2566, 7666, 1110, 5694, 7595, 5000, 1290, 4735, 5994, 9401, 6475, 9012, 5877, 2867, 7912, 3509, 5505, 885, 7490, 5622, 4374, 8721, 5134, 8788, 5430, 3869, 9852, 5762, 75, 5964, 262, 5565, 1599, 7525, 5388, 8612, 1143, 7938, 7580, 2953, 7901, 5629, 1456, 9852, 5216, 965, 3739, 7879, 1212, 9029, 9263, 9609, 1926, 8151, 1997, 6298, 5125, 5715, 4864, 3852, 604, 7652, 313, 6248, 4077, 3875, 3816, 7046, 9525, 3798, 6959, 9366, 2216, 4463, 6546, 6367, 614, 9477, 3176, 4098, 7162, 7535, 4696, 749, 2686, 8212, 9050, 255, 1389, 287, 1086, 9414, 9897, 2293, 31, 9121, 4682, 7084, 8951, 834, 1051, 2236, 3712, 6426, 8642, 185, 785, 8162, 6015, 658, 8923, 5741, 2551, 7629, 2095, 8882, 7695, 5629, 8684, 5116, 6362, 7701, 9441, 9403, 1108, 4395, 5688, 9466, 953, 9191, 4967, 7236, 6020, 3465, 8165, 872, 4530, 3353, 7859, 1422, 1504, 6366, 126, 1246, 1530, 1777, 8970, 4590, 2195, 6920, 9086, 689, 2163, 6035, 4961, 2055, 7699, 4121, 3971, 1824, 3707, 4405, 854, 6088, 6971, 1679, 1779, 7097, 5696, 2449, 2104, 3264, 796, 8595, 6183, 26, 5597, 7295, 5926, 9039, 4550, 9601, 5959, 3244, 7451, 5641, 2343, 6587, 3755, 4361, 3890, 446, 8187, 1979, 7000, 7094, 8658, 1647, 6090, 8332, 4407, 4570, 2340, 3057, 5029, 5424, 2736, 4844, 2771, 5782, 5912, 3745, 2504, 2782, 7247, 1393, 5403, 7175, 9903, 1723, 7600, 7021, 4566, 9778, 5188, 46, 8542, 7915, 5043, 4983, 519, 480, 8199, 1141, 73, 9316, 6248, 966, 3218, 6614, 6974, 5078, 9775, 7263, 6263, 7267, 1947, 5357, 286, 674, 3876, 1985, 4731, 1850, 512, 1493, 5310, 5443, 4183, 5963, 8642, 1389, 6320, 4264, 9565, 7348, 4378, 6192, 1300, 3393, 4794, 8323, 6063, 9651, 9368, 7899, 9053, 4933, 5140, 5604, 9114, 9299, 7603, 2485, 884, 7313, 4139, 9883, 1405, 9843, 7419, 1483, 2031, 8610, 4150, 3313, 6257, 3790, 1688, 994, 1357, 9660, 583, 5735, 1548, 7156, 9678, 8047, 3617, 9611, 7966, 7764, 5177, 7716, 4206, 7985, 6989, 6318, 5854, 8292, 9639, 687, 370, 3252, 7104, 5813, 758, 8219, 3809, 2506, 3605, 9340, 3559, 4118, 4757, 8229, 4258, 944, 1596, 4940, 622, 5832, 1270, 6948, 1744, 1125, 7895, 9348, 7601, 7426, 1975, 9611, 3722, 4143, 4979, 7904, 3221, 3817, 5755, 1798, 6549, 3463, 3190, 201, 6894, 6209, 3488, 670, 7643, 7020, 6164, 5583, 5036, 6309, 8644, 7961, 3465, 7795, 1486, 4535, 3111, 5252, 4049, 4253, 7515, 1517, 6148, 2438, 1296, 8826, 7924, 7761, 9126, 6951, 7110, 7549, 1170, 8533, 793, 1633, 6451, 6261, 5887, 8694, 6447, 8993, 6398, 1289, 2925, 2362, 3935, 6744, 1358, 1743, 3937, 9942, 3696, 1601, 8295, 3086, 2595, 9554, 8566, 1465, 2109, 3474, 3950, 9216, 8948, 2020, 3536, 943, 4934, 8377, 6171, 1243, 3525, 259, 3001, 4205, 4548, 4754, 2365, 8630, 4690, 7872, 5131, 3995, 2672, 728, 6532, 9785, 9379, 5865, 4774, 6660, 3721, 4451, 9085, 4771, 8008, 857, 9737, 5630, 4040, 3106, 5997, 4152, 8542, 3992, 3294, 5064, 2656, 5247, 635, 1521, 3026, 1502, 9396, 2171, 7188, 2425, 9758, 2640, 8648, 9454, 274, 9471, 8972, 9301, 911, 6023, 4155, 126, 7802, 2948, 5675, 6313, 69, 1374, 9925, 3685, 6901, 432, 1884, 4803, 8173, 9638, 3626, 695, 4286, 3836, 8670, 8834, 1444, 5187, 6281, 2482, 8801, 7656, 9066, 5138, 5160, 9857, 906, 5235, 7243, 5281, 5103, 5826, 5023, 3637, 5607, 1204, 5697, 3422, 1192, 8753, 6087, 2083, 3256, 8201, 9853, 1886, 3953, 4732, 7351, 6387, 9148, 2299, 4843, 3891, 3572, 874, 9873, 1235, 7323, 8860, 3439, 113, 5132, 6521, 1234, 7427, 4062, 1342, 2480, 641, 8802, 9788, 5336, 3649, 1301, 3268, 749, 1628, 9202, 2689, 3284, 9170, 5252, 1577, 1705, 5640, 2185, 2252, 4943, 271, 5117, 8699, 2743, 8221, 2119, 3851, 701, 2740, 4247, 7037, 9764, 4445, 5848, 6135, 6166, 5328, 2584, 1131, 3005, 8817, 2783, 7749, 6112, 5567, 9688, 2549, 7929, 8650, 60, 1896, 3998, 7345, 3352, 8990, 1143, 873, 1191, 5821, 9485, 5249, 3086, 8016, 9319, 4139, 3566, 8871, 7528, 7873, 4117, 1085, 7064, 8222, 5947, 4447, 1326, 5206, 12, 9703, 5711, 3951, 219, 6966, 3168, 2372, 9603, 9092, 1904, 1010, 2704, 2106, 7568, 3410, 296, 6825, 9781, 637, 4465, 7953, 6861, 2142, 2035, 9743, 1921, 3051, 7424, 7112, 7676, 5245, 9531, 2284, 4498, 6423, 6977, 3106, 1367, 5696, 2003, 1291, 3025, 76, 3147, 9094, 4580, 5097, 7390, 8637, 5853, 359, 3153, 4957, 6635, 5721, 3353, 2266, 3481, 7432, 3020, 7330, 1172, 5285, 1525, 2928, 5331, 8856, 2163, 5169, 1465, 4439, 1876, 7446, 2192, 5577, 726, 6599, 352, 3645, 7733, 8331, 5447, 8017, 5017, 7287, 6602, 7248, 6323, 4195, 9617, 2263, 4013, 450, 4073, 6131, 3569, 9019, 1858, 9827, 8118, 4972, 7422, 9666, 5760, 9213, 2817, 7952, 3948, 8683, 3645, 6402, 3264, 1919, 9276, 2519, 190, 766, 8940, 3413, 2644, 8048, 83, 9724, 7009, 3777, 9663, 2483, 5752, 4578, 8951, 5902, 2170, 9967, 894, 8556, 6049, 7254, 2746, 8962, 8317, 6848, 767, 7907, 1028, 9458, 6881, 4978, 6717, 8210, 3835, 1064, 7434, 746, 9449};
System.out.println(ans[n]);
}
}
如果口算不出來,看這個:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class M2020T9_1 {
static int[][] ans = new int[1001][1001];
static int dfs(int pre, int now) {
if (ans[pre][now] != -1) {
return ans[pre][now];
}
int result = 1;
for (int i = 1; i < Math.abs(pre - now); i++) {
result += dfs(now, i);
result %= 10000;
}
ans[pre][now] = result;
return result;
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("4"));
int n = Integer.parseInt(reader.readLine());
for (int[] an : ans) {
Arrays.fill(an, -1);
}
int result = 0;
for (int i = 1; i <= n; i++) {
result += dfs(n, i);
result %= 10000;
}
System.out.println(result);
}
}
10. 好看的節目[結構體排序]
和上次模擬一樣的題目,不說了。
輸入格式
輸入的第一行包含兩個整數 n, m ,表示節目的數量和要選擇的數量。
第二行包含 n 個整數,依次為每個節目的好看值。
輸出格式
輸出一行包含 m 個整數,為選出的節目的好看值。
樣例輸入
5 3
3 1 2 5 4
樣例輸出
3 5 4
樣例說明
選擇了第1, 4, 5個節目。
評測用例規模與約定
對於 30% 的評測用例,1 <= n <= 20;
對於 60% 的評測用例,1 <= n <= 100;
對於所有評測用例,1 <= n <= 100000,0 <= 節目的好看值 <= 100000。
題解:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
public class M2020T10 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// reader = new BufferedReader(new StringReader("5 3\n" +
// "3 1 2 5 4"));
String[] split = reader.readLine().split(" ");
int n = Integer.parseInt(split[0]);
int m = Integer.parseInt(split[1]);
split = reader.readLine().split(" ");
Program[] all = new Program[n];
for (int i = 0; i < n; i++) {
all[i] = new Program(i, Integer.parseInt(split[i]));
}
Arrays.sort(all, new Comparator<Program>() {
@Override
public int compare(Program program, Program t1) {
return t1.score - program.score;
}
});
Program[] all2 = Arrays.copyOf(all, m); // light
Arrays.sort(all2, new Comparator<Program>() {
@Override
public int compare(Program program, Program t1) {
return program.id - t1.id;
}
});
for (int i = 0; i < m; i++) {
System.out.print(all2[i].score + " ");
}
}
}
class Program {
int id;
int score;
Program(int id, int score) {
this.id = id;
this.score = score;
}
}
后記
感覺應該看點概念類的了,考試的時候不知道約數是什么,尷尬。
除了第九題卡住了思路,其他應該沒什么問題,對我的題解有疑問可以評論或私信。
因為博主本人比較菜雞,目前還在慢慢刷題,想一起學習的可以加我。
