英语 、算法 、数学

英语

每日一句长难句:
长难句

百词斩每日单词:
百词斩

百词斩爱阅读:
爱阅读

刘老师考研英语长难句语法:

算法

demo1:
在这里插入图片描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Arrays;
import java.util.Scanner;

/*
区间k大数查询
*/
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int a[] = new int[n];
for (int i=0; i<n; i++) {
a[i] = cin.nextInt();
}
int m = cin.nextInt();
int b[][] = new int[m][3];
for (int i=0; i<m; i++) {
for (int j=0; j<3; j++) {
b[i][j] = cin.nextInt();
}
}
for (int i=0; i<m; i++) {
int c[] = new int[n];
int index = 0;
for (int i1:a)
c[index++] = i1;
Arrays.sort(c,b[i][0]-1,b[i][1]);
System.out.println(c[(b[i][1]-b[i][2])]);
}
}
}

demo2:
在这里插入图片描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;

/*
最大最小公倍数
*/
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
long n = cin.nextLong();
long max;
if (n <= 2)
max = n;
else if (n % 2 == 1) // 奇数 偶数 奇数(互质最大) 9 8 7
max = n*(n-1)*(n-2);
else if (n % 3 == 0) // 30 29 28 (30 28 分2) 30 29 27(30 27分3) 故29 28 27
max = (n-1)*(n-2)*(n-3);
else // 其他N偶数 则避免分2 因此丢掉第二个偶数 16 15 13
max = n*(n-1)*(n-3);
System.out.println(max);
}
}

数学

泰勒公式其8倒背如流