# 第十四届蓝桥杯三月真题刷题训练——第 10 天

ThoU4 2023-03-13 09:53:38

``````public class Main {
public static void main(String[] args) {
System.out.println(4 + 19 + (21 * 20));
}
}``````

刷题统计

``````public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
long a = scan.nextLong();
long b = scan.nextLong();
long n = scan.nextLong();
long week = n / (a * 5 + b * 2);
long res = week * 7;
n %= (a * 5 + b * 2);
if(n > a * 5){
res += 5;
n -= a * 5;
res += ((n - 1) / b) + 1;
}else {
res += ((n - 1) / a) + 1;
}
System.out.println(res);
scan.close();
}
}``````

修剪灌木

``````public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
int n = scan.nextInt();
int max;
for (int i=1;i<=n ;i++) {
max = Math.max(i-1, n-i);
System.out.println(max * 2);
}
scan.close();
}
}``````

k倍区间

``````public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
long[] arr = new long[n];
long[] yu = new long[k];
long sum = 0;
long count = 0;
for (int i = 0; i <n ; i++) {
arr[i] = sc.nextInt();
count += arr[i];
arr[i] = count;
yu[ (int) (arr[i] % k) ]++;
}
sum += yu[0];
for (int i = 0; i < k ; i++) {
sum += yu[i] * (yu[i] - 1) /2;
}
System.out.println(sum);

}
}``````

...全文
21 回复 打赏 收藏 转发到动态 举报

50,782

• 近7日
• 近30日
• 至今

刷题！