自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

NULL

0

  • 博客(11)
  • 资源 (3)
  • 收藏
  • 关注

原创 POJ | 1323 Game Prediction | 贪心

至少可以赢几局,直接求占最大几次。#include #include #include int list[110], m, n;int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b;}int greedy(){ int result = 0, nohave = 0, j =

2013-06-05 22:16:27 457

原创 POJ | 1065 Wooden Sticks | 贪心

思路:先排序l,对于相等的情况排序w,然后求最大上升子序列。#include #include #include typedef struct _node { int l; int w; bool visit;}Node;Node a[5010];int n, m;int cmp(const void *b, const void *c){

2013-06-05 22:13:22 403

原创 POJ | 2709 Painter | 贪心

贪心求灰色颜色的数量,用50N的max做限定,详细见代码。思路: 最大的需求量决定了开始需要几套颜料。95ml需要2套。     最小的3种颜料剩余的最多,决定了是否需要再多套数。     每次计算完成需要重新排序。#include #include int n, a[15];int cmp(const void *a, const void *b){ ret

2013-06-05 22:04:50 464

原创 POJ | 1328 Radar Installation | 贪心

此题类似数轴上有N个点,用多少单位长度线可以覆盖,也类似活动选择问题。属于比较基础的贪心算法。思路:把点转换为x轴上线段覆盖的问题。如P2(-3, 1),转换成x轴为-3 - sqrt(d * d - 1 * 1) 和 -3 + sqrt(d * d - 1 * 1),左右两个点。对左点进行排序,判断各个线段之间的重叠情况,判断需要几个雷达。细节见代码。#include

2013-06-05 21:46:58 416

原创 BSF | 1915 | Knight Moves

跳马一样的题,更简单POJ 1915 Knight Moves#include #include #include #include using namespace std;int dir[8][2] = { {-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1} };int step[31

2013-05-28 14:21:13 302

原创 BFS | 3126 | Prime Path

搜索就是每位的0到9个数字3126 -- Prime Path#include #include #include #include #include using namespace std;const int Max = 10005;int prime[Max], dis[Max];bool visit[Max];queue Q;void funprime(

2013-05-21 13:59:18 305

原创 BFS | 3278 | Catch That Cow

经典题3278 Catch That Cow #include #include #include #include using namespace std; const int M = 200005; struct Node { int a; int step; Node(int _a, int _step) :

2013-05-21 13:50:49 282

原创 DFS | 2488 | 跳马

WA了很多次。2488 A Knight's Journey#include #include #define MAX 30bool visit[MAX][MAX], tag;int dir[8][2] = { {-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1} };int n,

2013-05-15 20:21:24 318

原创 BFS | 1426 | Find The Multiple

网上找到一个用同余做的,觉得写的不错,地址POJ 1426 Find The Multiple #include #include #include #include using namespace std;const int maxn = 200;queue Q;bool visit[maxn];long long a[maxn];void bfs(int

2013-05-14 16:03:58 347

原创 BFS | 3984 | 迷宫问题

学习BFS,找到raphealguo的博客介绍BFS,完成了这题。POJ 3984 迷宫问题#include #include #include using namespace std;int map[5][5], visit[25], path[25]; // int dir[4][2] = { {-1, 0}, {1, 0}, {

2013-05-13 20:56:47 393

原创 位运算 | 2453 | An Easy Problem

《编程之美》中2.1 求二进制数中1的个数,就找到这题来做,1AC,可是代码不够优化,看到discuss中牛人的代码,发现M神博客中的解释。POJ 2453 An Easy Problem #include int main() { int n, x; while (scanf("%d", &n), n) { x = n &

2013-05-13 20:10:08 380

基于USBKey的网上支付研究

基于USBKey的网上支付研究,详细介绍了USBKey的各个领域的基础知识

2012-09-24

基于USBKEY的CSP与PKCS_11互通的实现方法

基于USBKEY的CSP与PKCS_11互通的实现方法,好文章。

2012-09-24

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除