摘要: /**\ https://ac.nowcoder.com/acm/problem/14526 01背包问题变种 \**/ #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define 阅读全文
posted @ 2022-03-07 23:01 std&ice 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://codeforces.com/contest/1646/problem/C 3 题意给出一个数n,选择阶乘数和2次幂数的组合成n,求使用个数最小 4 两种做法: 5 1、dfs 暴力搜索(这道题dfs快点) 6 2、二进制状态压缩枚举 7 \**/ 8 #inclu 阅读全文
posted @ 2022-03-07 17:02 std&ice 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 1 for(int i = 0; i < (1 << n); i++) //0~2^n-1个状态 2 { 3 for(int j = 0; j < n; j++) 4 { 5 if(i & (1 << j)) //check每一位 6 { 7 8 } 9 } 10 } 阅读全文
posted @ 2022-03-07 16:58 std&ice 阅读(58) 评论(0) 推荐(0) 编辑