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

25 篇文章 1 订阅

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

import java.util.*;
import java.math.*;
import java.io.*;

public class Main {

static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

public static void main(String[] args) throws Exception {

//    	for (int i = 2; i <= 100; i++) {
//    		long num = 2019 * i;
//    		boolean flag = true;
//    		while (num > 0) {
//    			int t = (int)(num % 10);
//    			if ((t & 1) == 0) {
//    				flag = false;
//    				break;
//    			}
//    			num /= 10;
//    		}
//    		if (flag) {
//    			out.print(2019 * i);
//    			break;
//    		}
//    	}

out.println("139311");

out.flush();
in.close();
}
}


import java.util.*;
import java.math.*;
import java.io.*;

public class Main {

static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

public static void main(String[] args) throws Exception {

//    	for (int i = 2; i < 1000000; i++) {
//    		int cnt = 0, end = (int)Math.sqrt(i);
//    		for (int j = 1; j <= end; j++) {
//    			if (i % j == 0) {
//    				cnt += 2;
//    				if (i == j) cnt--;
//    			}
//    		}
//    		if (cnt == 100) {
//    			out.println(i);
//    			break;
//    		}
//    	}

out.println("45360");

out.flush();
in.close();
}
}


import java.util.*;
import java.math.*;
import java.io.*;

public class Main {

static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

static int N = (int)2e5 + 10, n;
static int[] arr = new int[N], pre = new int[N];
public static void main(String[] args) throws Exception {
for (int i = 1; i <= n; i++) {
arr[i] = Integer.parseInt(s[i - 1]);
pre[i] = arr[i] + pre[i - 1];
}
long ans = 0L;
for (int i = 1; i <= n; i++) {
ans += (long)arr[i] * (pre[n] - pre[i]);
}
out.println(ans);

out.flush();
in.close();
}
}


import java.util.*;
import java.math.*;
import java.io.*;

public class Main {

static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

static int N = (int)1e6 + 10, n, m;
static Integer[] a = new Integer[N];

public static int helper(int n, int m) {
for (int i = 0; i < n; i++) a[i] = i + 1;
Arrays.sort(a, 0, n, new Comparator<Integer>() {

@Override
public int compare(Integer o1, Integer o2) {
int a = 0, b = 0, n1 = o1, n2 = o2;
while (n1 > 0) {
a += n1 % 10;
n1 /= 10;
}
while (n2 > 0) {
b += n2 % 10;
n2 /= 10;
}
if (a > b) {
return 1;
} else if (a < b) {
return -1;
}
return o1 - o2;
}
});

return a[m - 1];
}

public static void main(String[] args) throws Exception {

out.println(helper(n, m));

out.flush();
in.close();
}
}


• 0
点赞
• 0
收藏
觉得还不错? 一键收藏
• 打赏
• 2
评论
07-28
09-28 345
09-29 320
09-28 265
09-30 287
10-03 346
10-02 178

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

⠀One0ne

¥1 ¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。