暴力求解法
文章平均质量分 75
Falling~
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
暴力求解法--打表 hdu5878 I count Two Three
求大于等于n的2^a * 3^b * 5^c * 7^d (a,b,c,d >= 0,1 1.1e9有10位数2 ^ 32 > 1e9, 3 ^ 19 > 1e9 , 5 ^ 13 > 1e9 , 7 ^ 11 > 1e92.大于1e9及时退出,不存入set#include #include #include #include using原创 2017-08-16 15:48:43 · 404 阅读 · 0 评论 -
暴力求解法--8皇后问题
//C[i]记录第i行的皇后所在列,转变为全排列问题#include #include using namespacestd;const int maxn =20;const int INF =1 30;int n,tot = 0;int C[maxn];bool vis[3][maxn];void s原创 2017-07-29 11:44:21 · 590 阅读 · 0 评论 -
暴力求解法--生成子集
#include using namespacestd;//推荐二进制法,所以放在最前面void print_subset(int n,int s){ for (int i = 0; i if (s & (1 printf("%d",i); } printf("\n");}v原创 2017-07-29 11:41:53 · 428 阅读 · 0 评论 -
暴力求解法--生成全排列
当然,最好用的还是STL的next_permutation(a,a + n)#include using namespacestd;void print_permutation_1n(int n,int cur,int *a)//生成1-n的全排列{ if (cur == n) {//递归出口 for(int i =0原创 2017-07-29 11:38:37 · 705 阅读 · 0 评论 -
枚举--hdu5936 difference
Little Ruins is playing a number game, first he chooses two positive integers y and K and calculates f(y,K), heref(y,K)=∑z in every digits of yzK(f(233,2)=22+32+32=22)then he gets原创 2017-08-09 16:33:46 · 389 阅读 · 0 评论
分享