自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 资源 (1)
  • 收藏
  • 关注

转载 深入探讨MFC消息循环和消息泵

深入探讨MFC消息循环和消息泵作者:周焱首 先,应该清楚MFC的消息循环(::GetMessage,::PeekMessage),消息泵(CWinThread::PumpMessage)和 MFC的消息在窗口之间的路由是两件不同的事情。在MFC的应用程序中(应用程序类基于CWinThread继承),必须要有一个消息循环,他的作用是从 应用程序的消息队列中读取消息

2010-05-03 17:52:00 537

原创 VS挤房间探索(含源码)

最近在网上看到一个VS挤房器,就想自己也实现一下玩玩。这里主要是对远程进程空间中的控件发送消息的知识。算法流程:1. 先找到VS窗口2. 找到VS窗口中显示房间列表的SysListView32控件3. 读取房间列表, 这里是跨进程读取,方法是对SysListView32控件发送消息4. 创建2个线程5. 线程1任务:模拟不停的双击,由于VS中进入房间是通过双击进行的

2010-03-01 23:10:00 2686 5

原创 Flip Game翻转游戏

4*4的棋盘,棋盘上的每个位置都是黑或白,每个位置的颜色可以翻转,并且翻转一个位置的同时其周围的棋子的颜色也同时翻转。给一个目标状态,问多少步可以到达目标状态。 广度优先搜索。 #include #include using namespace std;struct STATE { bool map[4][4]; int step;};STAT

2010-01-14 14:42:00 769

转载 Qt源码分析之信号和槽机制

Qt的信号和槽机制是Qt的一大特点,实际上这是和MFC中的消息映射机制相似的东西,要完成的事情也差不多,就是发送一个消息然后让其它窗口响应,当然,这里的消息是广义的说法,简单点说就是如何在一个类的一个函数中触发另一个类的另一个函数调用,而且还要把相关的参数传递过去.好像这和回调函数也有点关系,但是消息机制可比回调函数有用多了,也复杂多了MFC中的消息机制没有采用C++中的虚函数机制,原

2009-12-26 00:34:00 735 1

原创 uva100 The 3n + 1 problem

记忆化搜索,就是说如果f[n]已经计算过,直接使用, 另外注意数组越界问题。为了加快查询速度,使用RMQ, 即区间最值。用动态规划的方法来查询某个区间的最值。pku1207也是这道题目,不过规模变小了很多。 #include #include #define MAXN 1000001unsigned long f[MAXN];unsigned long

2009-12-04 15:10:00 625

原创 解一次模互质同余方程组

pku1006, 解一次模互质同余方程组x=p mod 23;x=e mod 28;x=i  mod 33;求x #include #include using namespace std;int gcd(int m, int n) // 用户必须保证m,n的合法性!{ int temp; while( m%n != 0 )

2009-12-04 14:59:00 909

原创 pku1816 Wild Words (trie)

a-z与?*的匹配,利用trie来实现的  #include #include #include using namespace std;vector res;const int kind=28;//字母种类struct Treenode//树的结点结构{ vector ids;//这个附加变量在本题中记录遍历到该结点形成的字符串出现的次数,

2009-11-30 16:33:00 606

原创 pku2002 Squares (折半查找)

枚举正方形的一条边,查找满足条件的另外两个顶点是否存在,使用折半查找 #include #include using namespace std;struct POINT { int x; int y;} ps[1001];int n;bool comp(POINT p1, POINT p2){ if (p1.x != p2.x

2009-11-30 14:43:00 470

原创 pku2001 Shortest Prefixes (trie)

trie, 查找区别其他字符串的最短前缀。 #include #include char str[1010][25];int n;const int kind=26; //字母种类struct Treenode //树的结点结构{ int count; //这个附加变量在本题中记录遍历到该结点形成的字符串出现的次数,在不同题中可记录

2009-11-30 12:40:00 659

原创 pku1204 Word Puzzles (Trie)

trie, 递归和非递归的查询都实现了一下 #include #include using namespace std;char str[1010][1010];int L, C, W;int srcx, srcy;int dir[8][2] = {{-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1,

2009-11-30 11:41:00 685

原创 pku1063 Flip and Shift

#include using namespace std;int pos[31];int m, n, loop;int main(){ int t, i, j, k, sum1, sum2, odd, even; cin >> t; while (t--) { cin >> loop; for (m=0, n=0, i=0; i<loop;

2009-11-22 00:28:00 468

原创 pku1036 Gangsters (动态规划)

 dp[i][j]表示当第i个海盗进门时门的状态为k,这时获得的最多钱 #include #include using namespace std;int n, k, time, r;struct INFO { int T; int P; int S;} info[102];int dp[101][101]; //dp[i][j

2009-11-22 00:18:00 626

原创 pku2138 Travel Games (搜索)

 比较简单的搜索,主要是决定任意两个字符串之间是否有题目所要求的关系  #include #include #include using namespace std;vector adj[1000];char str[1000][84];int len[1000];int first, D;char fstr[84];int a

2009-11-20 23:16:00 557

原创 pku1699 Best Sequence (搜索)

 求多个子串的最短父串,  #include #include using namespace std;char str[10][22];bool flag[10];char res[220];int ans, n;void search(int depth, int curlen){ if (curlen > ans) re

2009-11-20 21:56:00 607

原创 pku2157 Maze (搜索)

 迷宫中有钥匙和门,收集到钥匙能打开对应的门,问能否走出迷宫,这里的算法是多次广度优先搜素,每次广度优先搜索收集钥匙,看能否走到目的地,如果走不到目的地,则拿出收集到的钥匙打开门,继续广度优先搜索。 如果钥匙收集完了,到不了目的地,也打不开新的门,说明无解。 #include #include using namespace std;int keynum[5], ke

2009-11-20 21:47:00 591

原创 pku2312 坦克大战 (搜索)

 经典游戏坦克大战, 问从位置YOU到位置TARGET的最少步数,类似迷宫的问题 #include #include using namespace std;int m, n, srcx, srcy;char tmap[300][300];struct POINT{ int x; int y; int sth; //0为无障碍,

2009-11-20 12:37:00 557

原创 pku3740 Easy Finding (搜索)

 给一个M*N的矩阵,矩阵元素均为0, 1问是否可以选出一些行,使得这些行的每一行有且仅有一个1例如 中的1, 4, 5行满足这个条件这里的数据规模比较小,直接深度搜索就可以。 #include #include bool mat[16][300];bool ans, flag[300];int n, m;void dfs(int d

2009-11-19 23:54:00 525

原创 pku2033 Alphacode (动态规划)

 简单DP, #include #include using namespace std;char str[10000];int dp[10000];int main(){ char ch1, ch2; int len, i; while (cin>>str && str[0]!=0) { memset(dp, 0, si

2009-11-19 00:08:00 467

原创 pku2153 Rank List (STL的运用)

 #include #include #include #include using namespace std;int grade[10001];int stunum, examnum;char name[10001][32];int main(){ map msi; map::iterator ii; int i, j,

2009-11-18 22:24:00 528

原创 pku3211 Washing Clothes(动态规划)

类似0-1背包问题的动态规划 #include using namespace std;/*#include ifstream fin("data.txt");#define cin fin*/int M, N;char colors[10][12];int clothes[10][101];int clothnum[10];

2009-11-18 21:31:00 553

原创 pku1887 最长递减子序列

利用动态规划来计算最长递减子序列。dp[i]为以h[i]结尾的最长递减子序列的长度 #include using namespace std;int h[10000];int dp[10000];#define max(a,b) ((a)>(b)?(a):(b))int main(){ int len, next, ans, i, j, cou

2009-11-18 21:04:00 808

原创 pku3253 Fence Repair

 利用构建赫夫曼树的贪心思想来维护一个小顶堆 #include #include using namespace std;int N;int woods[20001];int main(){ int i, j; while (cin >> N) { for (i=0; i<N; i++) cin >> woods[i];

2009-11-17 13:37:00 513

原创 pku1882 Stamps (动态规划)

 题目大意是求n种面值的邮票能连续组合出的最大值。如面值1和3的邮票取5张可以组合出1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15但1-13中间是连续的,所以连续组合出的最大值为13采用的算法为动态规划 #include using namespace std;bool flag[1002];int deno[10];i

2009-11-17 00:25:00 582

原创 pku1972 Dice Stacking

 比较简单的题在第一个骰子放法固定之后,第二个骰子的底面值必须和第一个骰子的顶面值一样,所以第二个骰子的底面是一定的,将与底面相邻的4个面的最大值转出来,同理,将第三个骰子的与底面相邻的4个面中的最大值转出来,这样可以得到第一个骰子放置方式固定后的面最大值。第一个骰子的放置方式有6种,取这6个放置方式的面最大值就是解。代码比较WS。。 #include #include

2009-11-15 01:28:00 515

原创 pku2385 Apple Catching (动态规划)

 比较简单的DP, 利用滚动数组,代码如下: #include using namespace std;int dp[2][31][2];int t, w;int tree[1001];#define max(a, b) ((a)>(b) ? (a):(b))int main(){ int i, j, k, ans, sel; while

2009-11-09 21:27:00 423

原创 pku3638 Moogle (动态规划)

 题目地址:http://acm.pku.edu.cn/JudgeOnline/problem?id=3638 题目大意:一个地图软件需要需要存储h个房子的坐标信息,但为节约存储空间可以只存储其中的c个房子的坐标信息,其他房子的坐标信息可以由插值得到。问怎样选择这个c个房子,使得所有房子的插值误差之和最小, 输出最小的插值误差均值。 题目分析:动态规划,状态定义为: dp[i][j]表

2009-11-09 20:44:00 657

原创 pku3639 Exchange Rates (动态规划)

 Exchange RatesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1942Accepted: 647DescriptionNowthat the Loonie is hovering about par with

2009-11-09 20:23:00 1032

原创 ShowHTMLDialog的用法

ShowHTMLDialog的用法 一个好用的函数ShowHTMLDialog, mshtml.dll导出的可以用它来执行一些脚本. 很方便#include "stdafx.h"#include #pragma    comment(lib, "urlmon.lib")typedef   HRESULT   STDAPICALLTYPE   MYSHOWHTML

2009-11-05 14:30:00 2078

原创 pku1239 Increasing Sequences (动态规划)

 Increasing SequencesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1584 Accepted: 662DescriptionGivena string of digits, insert commas to cr

2009-11-02 18:09:00 1770 1

原创 pku1019

 Number SequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 16917Accepted: 4450DescriptionAsingle positive integer i is given. Write a prog

2009-10-29 19:30:00 887

原创 Ubuntu常用命令列表

系统信息命令uptime  联机信息-时间,显示如下    11:27pm    up 9 days, 7:12,       3 user,   load average:  0.07,   0.12,    0.14    当前系统时间             系统运行时间          当前在线用户数            系统负荷          1分   

2009-10-28 00:22:00 3149

原创 Ubuntu启动流程学习笔记(Upstart事件机制)

Debian启动系统维护者们说,现在的Debian Sysvinit启动系统因为其不可靠性,将会逐渐被upstart代替。 UpStart: 基于事件的启动系统Sysvinit:基于结果的启动系统SysVinit守护进程(sysvinit软件包)是一个基于运行级别的系统,它使用运行级别(单用户、多用户以及其他更多级别)和链接(位于/etc /rc?.d目录中,分别链接到/etc/i

2009-10-27 22:57:00 5324

原创 pku1014 Dividing (DP)

动态规划,和pku1276的算法是基本一样的显然,如果总价值为奇数,则均分是不可能的,如果总价值为偶数,则看各种marble的线性组合值能否为总价值的一半,如果可能,则可均分#include using namespace std;/*#include ifstream fin("data.txt");#define cin fin*/int mar

2009-08-25 20:20:00 127 1

原创 pku1276 Cash Machine (DP)

动态规划,n个数的线性组合注意其中的逆序更新, flag[i]表示这n个数的线性组合结果能否为i每次更新从0到end之间的部分#include using namespace std;/*#include ifstream fin("data.txt");#define cin fin*/int dk[11], nk[11], n, cash

2009-08-25 15:50:00 448

原创 zju1161

枚举+贪心在取钓鱼数最多的湖时候可以用优先队列#include  #include  using  namespace std;/*#include  ifstream  fin("data.txt");#define   cin  fin*/int  n, h, fi[26], ti[26], di[26];int  timepath[26

2009-08-05 09:04:00 370

原创 zju1103

简单的bfs,状态表示为3个pieces的坐标,状态转移就是寻找可用的边走下去,注意到1 2 3和3 2 1是一个坐标,也就是说3个pieces的坐标是对称的所以将这3个数排序,以减少状态总数 #include  #include  #include  using namespace std;/*#include  ifstream  fin("

2009-08-04 15:02:00 417

原创 zju1093

简单的DP状态是h[i][j], 代表顶面是第i块的第j面时的最高高度状态转移很简单#include using namespace std;/*#include ifstream fin("data.txt");#define cin fin*/int n;int blocks[31][3];int faces[3][3] =

2009-07-31 22:41:00 406

原创 zju1092

类似于Floyd算法的动态规划#include  #include  using namespace std;/*#include  ifstream  fin("data.txt");#define  cin  fin*/int  n, m;char name[31][100];double  g[31][31];void  cal

2009-07-31 22:39:00 402

一个利用串口传输文件的程序

MFC写的一个利用串口传输文件的程序~~

2008-12-15

空空如也

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

TA关注的人

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