暴力求解法
文章平均质量分 74
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 > 1e9 2.大于1e9及时退出,不存入set #include #include #include #include using原创 2017-08-16 15:48:43 · 350 阅读 · 0 评论 -
暴力求解法--8皇后问题
//C[i]记录第i行的皇后所在列,转变为全排列问题 #include #include using namespace std; 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 · 529 阅读 · 0 评论 -
暴力求解法--生成子集
#include using namespace std; //推荐二进制法,所以放在最前面 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 · 364 阅读 · 0 评论 -
暴力求解法--生成全排列
当然,最好用的还是STL的next_permutation(a,a + n) #include using namespace std; 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 · 599 阅读 · 0 评论 -
枚举--hdu5936 difference
Little Ruins is playing a number game, first he chooses two positive integers y and K and calculates f(y,K), here f(y,K)=∑z in every digits of yzK(f(233,2)=22+32+32=22) then he gets原创 2017-08-09 16:33:46 · 303 阅读 · 0 评论