摘要: 一、分治法 时间复杂度:O(NlogN) 通过70%样例,超时 import java.util.*; public class Main { static int res = 0; static void solution(int[] a, int i, int j, int x) { if(i 阅读全文
posted @ 2020-06-23 23:20 li修远 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 典型01背包问题 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); i 阅读全文
posted @ 2020-06-23 22:00 li修远 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1. 前缀和与差分及其应用 有两个数组A和B。 前缀和数组A: \(a_1 , a_2, a_3..., a_n\) 差分数组B: \(b_1, b_2, b_3, ..., b_n\) 数组A和B的关系如下: (1)前缀和数组A: $a_1 , a_2, a_3..., a_n$又等于 \(b_1 阅读全文
posted @ 2020-06-23 20:56 li修远 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 排序+深搜+剪枝 import java.util.*; public class Main { static int dfs(int[] a, int n, int u, long sum, long pi) { int res = 0; for(int i=u; i < n; i++) { if 阅读全文
posted @ 2020-06-23 13:08 li修远 阅读(121) 评论(0) 推荐(0) 编辑