摘要: 先明白 基数排序 基数排序(radix sort)属于“分配式排序”(distribution sort),又称“桶子法”(bucket sort)或bin sort,顾名思义,它是透过键值的部份资讯,将要排序的元素分配至某些“桶”中,藉以达到排序的作用,基数排序法是属于稳定性的排序,其时间复杂度为 阅读全文
posted @ 2017-07-19 00:05 Aragaki 阅读(98) 评论(0) 推荐(0) 编辑
摘要: int BiSearch(int len, int w) { int left = 0, right = len - 1; int mid; while (left <= right) { mid = left + (right-left)/2; if (bz[mid] > w) right = m 阅读全文
posted @ 2017-07-18 22:47 Aragaki 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <queue> #include <vector> using namespace std; const int N=405; struct rec { int v,w; }; vector<rec> edge[N*N]; int n,st, 阅读全文
posted @ 2017-07-18 22:41 Aragaki 阅读(246) 评论(2) 推荐(0) 编辑
摘要: A:树形DP 给出一棵树,但是它的边是有向边,选择一个城市,问最少调整多少条边的方向能使一个选中城市可以到达所有的点,输出最小的调整的边数,和对应的点 要改变的边的权值为1,不需要改变的边的权值为0, 两次dfs 第一次算出以1点为根节点到所有点要改变的边数,第二次以1为根节点向下遍历节点 算出每一 阅读全文
posted @ 2017-07-17 22:32 Aragaki 阅读(118) 评论(0) 推荐(0) 编辑
摘要: A: B:按题意直接暴力找符合题意的数的个数 #include <bits/stdc++.h> #include <cstring> #include <iostream> #include <algorithm> #define foror(i,a,b) for(i=a;i<b;i++) #def 阅读全文
posted @ 2017-07-17 22:20 Aragaki 阅读(168) 评论(0) 推荐(0) 编辑
摘要: B:读懂题意模拟 #include <bits/stdc++.h> #include <cstring> #include <iostream> #include <algorithm> #define foror(i,a,b) for(i=a;i<b;i++) #define foror2(i,a 阅读全文
posted @ 2017-07-17 22:12 Aragaki 阅读(179) 评论(0) 推荐(0) 编辑
摘要: A 略 B 略 C: 先对Ai数列预处理前缀和 然后把Bi的每个都加一次 最终得到的结果为ans[sum]++; 最后如果有一个ans[sum]>=k即满足所有K个条件就输出(注意!!前缀和要进行unique操作!!!因为可能会有+1 -1 +1这种出现 #include <bits/stdc++. 阅读全文
posted @ 2017-07-17 11:28 Aragaki 阅读(152) 评论(0) 推荐(0) 编辑
摘要: sstream ss()自动去除空格 例: 输出是1\n2\n3\n4\n; unique的作用是“去掉”容器中相邻元素的重复元素 它实质上是一个伪去除 它会把重复的元素添加到容器末尾 而返回值是去重之后的尾地址 阅读全文
posted @ 2017-07-14 11:27 Aragaki 阅读(164) 评论(0) 推荐(0) 编辑
摘要: A:水.看0多还是1多就行 B:模拟二进制运算 ,,卡了好久 不应该 #include <bits/stdc++.h> #include <cstring> #include <iostream> #include <algorithm> #define foror(i,a,b) for(i=a;i 阅读全文
posted @ 2017-07-13 20:28 Aragaki 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 状态比较容易表示,转移方程比较好想,问题比较基本常见 递推、背包、LIS(最长递增序列),LCS(最长公共子序列) HDU 2048 数塔 由上往下推 状态数太多(100!) 可以由下往上推: dp[i][j]=max(dp[i+1][j],dp[i+1][j+1])+dp[i][j]) 储存的话就 阅读全文
posted @ 2017-07-13 11:53 Aragaki 阅读(165) 评论(0) 推荐(0) 编辑