摘要: #include <bits/stdc++.h> using namespace std; const int N = 6060; int h[N], e[N], ne[N],idx; int w[N], f[N][2]; bool hasF[N]; int n; void add(int a, i 阅读全文
posted @ 2020-08-18 20:48 Sexyomaru 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 方法一: 背包模型 #include <bits/stdc++.h> using namespace std; const int N = 10010, mod = 1e9 + 7; int dp[N][N]; int n; int main() { scanf("%d",&n); for(int 阅读全文
posted @ 2020-08-18 20:00 Sexyomaru 阅读(164) 评论(0) 推荐(0) 编辑
摘要: class Solution { int[] color; Map<Integer,List<Integer>> map; public boolean possibleBipartition(int N, int[][] dislikes) { map = new HashMap<>(); col 阅读全文
posted @ 2020-08-18 16:22 Sexyomaru 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 方法一:记录0的个数减1的个数有没有出现过 class Solution { public int findMaxLength(int[] nums) { int n = nums.length; Map<Integer,Integer> map = new HashMap<>(); map.put 阅读全文
posted @ 2020-08-18 15:37 Sexyomaru 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 方法一:动态规划 分奇数和偶数的情况 class Solution { public int[] countBits(int num) { int[] dp = new int[num+1]; for(int i = 0; i <= num; i++) { if(i % 2 == 0) dp[i] 阅读全文
posted @ 2020-08-18 14:51 Sexyomaru 阅读(80) 评论(0) 推荐(0) 编辑