- 博客(34)
- 收藏
- 关注
转载 Delphi 线程间发送消息
线程B向线程A发送消息,SendMessage(线程A句柄, msg, wParam参数, lParam参数);线程A重写WndProc(var Message: TMessage); 1 { 线程B发送消息 } 2 unit ThreadUnit; 3 4 interface 5 6 uses 7 Classes, ActiveX, busi...
2017-11-30 10:11:00
607
转载 Delphi 判断exe是否以管理员身份启动
1 1:获取程序运行的用户名 2 function GetProcessIdentity(): String; 3 var 4 hToken: THandle; 5 UserName, UserDomain: String; 6 cbName, cbDomainName: ULONG; 7 ReturnLength: DW...
2017-11-13 11:00:00
437
转载 inno setup打包service
用inno打包service老外已经把这块代码封装好,我们只要引用就行了。注意:inno setup有两版本一个是Unicode编码一个是ansi编码,这里必须用Unicode编码打包。不然写进Windows service时会乱码。区分:打开inno带u的是unicode编码。[code]#include "services_unicode.iss"const ...
2017-09-26 21:29:00
764
转载 Delphi 代码实现窗口透明+圆角边框
1 procedure TfrmRemoteData.DoInvisible; //透明 2 var 3 control: TControl; 4 index, margin, X, Y, ctlX, ctlY, i: Integer; 5 fullRgn, clientRgn, ctlRgn: THandle; 6 begin 7 mar...
2017-08-25 11:03:00
393
转载 Delphi主窗体实现透明
设置以下属性即可实现透明窗体显示文字:===========================================设置窗体属性:BorderStyle 属性设置为 bsNoneColor属性设置为 clWhite(白色:窗体背景色)TransparentColor...
2017-08-25 10:59:00
296
转载 POJ 3061
题意:给你 n 个正整数以及整数s,求出总和不小于 s 的连续子序列的长度最小值。若无则输出 0 ;题解:枚举 + 二分; 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <time.h> 5 #in...
2015-01-09 19:40:00
59
转载 HDU 5144
题意:在给定的高度和初速度,任意抛使得它水平距离最远。题解:我们可以很容易的推出length = v*cos(x)*( sqrt( 2.0*h*g + v*v*sin(x)*sin(x) ) + v*sin(x) ) / g; 然后对 [ 0, π/2 ] 之间的弧度三分查找(凸线图形一般用三分) 1 #include <stdio.h> 2 #inc...
2014-12-14 22:05:00
112
转载 HDU 1018
题意:求n!的位数题解:斯特林数:log10(n!)=1.0/2*log10(2*pi*n)+n*log10(n/e)。 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <math.h> 5 #defin...
2014-12-09 22:34:00
64
转载 HDU 5139
题意:已知求f(n)。题解:可以转为f(n) = 1!*2!*3!... *n!。这题数很大,要小心内存和时间。我们可以只存f(0)f(10)f(20)...f(10000000),这样可以解决时间问题,内存我们可以将存的这些数都除以10,然后这题就OK了。 1 #include <stdio.h> 2 #include <string.h&g...
2014-12-09 12:50:00
101
转载 HDU 5124
题意:给定 n 个区间,问最多重复的子区间?题解:(离散化思想)讲所有的数都排个序,将区间的左值定为 1 ,右值定为 -1 ,这样对所有的数搜一遍过去找最大的值即可 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include &...
2014-12-03 21:43:00
120
转载 FAFU 1557
构建字典序,模拟二叉树建26叉树 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <math.h> 5 #include <time.h> 6 #include <ctype.h&g...
2014-12-02 20:34:00
94
转载 HDU 1028
整数划分问题是将一个正整数n拆成一组数连加并等于n的形式,且这组数中的最大加数不大于n。 如6的整数划分为 6 5 + 1 4 + 2, 4 + 1 + 1 3 + 3, 3 + 2 + 1, 3 + 1 + 1 + 1 2 + 2 + 2, 2 + 2 + 1 + 1, 2 + 1 + 1 + 1 + 1 1 + 1 + 1 + 1 +...
2014-12-02 19:33:00
109
转载 POJ 3126
题意:给你俩个素数(四位数)A 和 B,你每次可以改变其中的每一位,不能有前导 0 ,在前面出现过的数不能再出现,问要最少经过多少次改变使得 A 变成 B ,如果不能则输出 “Impossible”。题解:bfs ,枚举每一位的每一个数( 0 ~ 9 ),注意前导 0 的情况。 1 #include <cstdio> 2 #include <cs...
2014-11-23 15:18:00
87
转载 HDU5108
题意:给你一个正整数n, 找到一个最小的数m,使得n/m为质数。题解:质因数分解 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 typedef long long ll; 5 6 int main() 7 { 8 l...
2014-11-23 12:38:00
126
转载 POJ 1716
题意:在几个区间里面,挑选出几个数字组成一个集合,使得每个区间都至少有两个数字在这个集合里面,求这个集合的最少数字个数。题解:贪心法,先对区间排序下,以右端点排序,把每个区间扫一遍过去,看区间内有几个元素在当前集合中。 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdl...
2014-11-22 15:25:00
68
转载 HDU4790
题意:x 属于[a, b] , y 属于[c, d], 求( x+y )% p = m 的概率。思路:模拟 a+b, a+b+1 ...... ...... a+d-1, a+d a+1+b ...... ...... a+d-1, a+d, a+d+1 a+2+b ...... ...... ... a+d, a+d+1, a+d+2 ...
2014-11-20 16:43:00
110
转载 HDU1269
判断强联通图 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <cctype> 6 #include <time.h> 7 #include ...
2014-11-19 20:52:00
110
转载 POJ 2376
题意:问最少要几个区间才能使区间 [ 1, T ] 全被覆盖掉 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5 #include <cmath> 6 #include &l...
2014-11-14 14:30:00
74
转载 POJ 3050
我是开了个六维的数组来记住它的每一步 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5 #include <cmath> 6 #include <time.h> ...
2014-11-13 21:31:00
94
转载 POJ 3669
题意:已知流星的颗数,落地的坐标和落地时间,若流星落在某点则该点周围的四点也会被波及,现在要求你到达一点没有被流星击过的点最少时间注意:只能在第一象限内包括X,Y轴的正半轴 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include ...
2014-11-12 22:15:00
130
转载 POJ 3009
题意:已知起点和终点,求石子从起点到达终点的最短路,如果无法到达,则输出-1。石子移动的具体规则如下:1、开始时,石子在起点s处2、运动方向可以是水平或垂直的,不能斜方向运动3、最开始的时候,你可以将石子向上下左右任意一个方向抛,如果与它相邻的点是障碍物的话除外4、一旦石子开始运动,有三种可能:a、遇到障碍物,石子会停在障碍物的前一格,障碍物会消...
2014-11-12 14:22:00
66
转载 POJ 3253
题意:分割木板每次切断时,需要的代价是这块木板的长度。求最小代价(哈夫曼树)题解:每次找出最短的木板L1和次短的木板L2,意味着他们是从一块长度为( L1+L2 )木板上切割下来的,然后把( L1+L2 )这块板放进数列把L1和L2从数列中删掉,数列长度减一,依次循环。注意:当最小的板为当前数列的最后一块,就应该把( L1+L2 )放在L2的位置,因为每做一次数列长度就要减一。...
2014-11-10 21:03:00
105
转载 POJ 3617
题意:给定长度为N的字符串S,现要构造一个字符串T(起初为空串)。任意进行一下的一种操作:1>从S的头部删除一个字符,加到T的尾部2>从S的尾部删除一个字符,加到T的尾部目的使T的字典序最小。每80个字母一行注意:当首尾俩个数相同时,我们应比较里面的俩个次首和次尾 1 #include <cstdio> 2 #include ...
2014-11-10 19:35:00
90
转载 POJ 3984
题意:给你5*5的矩阵,要求你从左上角(0,0)走到右下角(4,4)的最短路径。题解:用对路径用bf,我们记住每个点的前驱,输出用dfs 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5...
2014-11-10 16:33:00
76
转载 UVA10012
题意:题目意思很简单就是如何安排圆使得他们所用的空间最小,前提是每个圆都必须和底边接触注意:存在小圆会插在俩个大圆的底下,这样就需要加一个圆心坐标和一个原点记录位置来做特判,令当前放置的圆与前面所有的圆相切求出最大的据原点的距离(这样就可以保证排除圆圆相交的情况),再加上前面的距离即为放置这个新的圆的位置坐标。 1 #include <cstdio>...
2014-11-09 20:00:00
54
转载 HDU5100
1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5 #include <cmath> 6 #include <ctime> 7 #include <str...
2014-11-09 14:09:00
102
转载 HDU 5101
题意: 在任意俩个班级中个选一人 使得他们的和大于Dudu的智商思路:枚举一个班级中的每个人再对另一个二分查找 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5 #include <...
2014-11-09 13:57:00
83
转载 UVA301 运输
可以看成01背包问题//题意:求取列车公司最大利润,对于某一区间的车票要拒则全拒。求如何运载盈利最大 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cctype> 4 #include <cstring> 5 #include <cmath&g...
2014-11-04 19:59:00
75
转载 UVA 331 交换的方案数
题意:交换一个数组的相邻两个元素可以达到对数组排序的功能,类似于冒泡排序,但交换的方案可能不止一种。比如说数组A【3】为3,2,1,要想排为1,2,3,可以先交换位置1和2的元素(数组变为2,3,1),然后交换位置2和3的元素(变为2,1,3),最后交换位置1和2的(变为1,2,3),此为方案一,具体可以用1,2,1(数字即每次交换的第一个数的位置)来描述。当然还可以先交换位置2和3(3...
2014-11-03 21:49:00
82
转载 uva 10344 算23点
// 题意:输入5个整数,按照某种顺序排列后依次进行+, -或者*,使得最终结果为23。判断是否有解// 算法:回溯 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cctype> 4 #include <cstring> 5 #includ...
2014-11-03 18:42:00
98
转载 HDU 5087
DP找次最大最大子序列 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <ctime> 5 #include <cmath> 6 #include <cctype> 7 #include ...
2014-11-02 14:00:00
72
转载 uva639 暴力、回溯
题意:在象棋中,“车”是可以在棋盘上沿着纵向或横向走任意格子的棋子。 在这个问题中,我们假设有一个4*4的小棋盘,在这个棋盘上面包含着“墙”,而“车”是不能越过墙的。而我们的目标就是尽可能地放置更多地“车”到这个棋盘上去,使所有的这些”车“互相不能吃到其它棋子。在上面几副图中给出了几个样例, 棋盘上,格子全部是黑色的代表是“墙”, 黑色圆形的代表是“车”。其中第二,三...
2014-10-30 20:54:00
106
转载 uva127
你的任务是模拟一种叫「Accordian」的纸牌游戏,他的游戏规则如下: 一副扑克牌有52张牌,首先把纸牌一张一张由左到右排好(不能有重叠,所以共有52堆牌,每堆一张),当某一张牌与他左边那张牌或者左边的第三张牌有「Match」的时候,就把这张牌移到那张牌上面去。在这里两张牌「Match」指的是这两张牌的花色(suit)或者点数(rank)一样。当你做了一个移动之后,要察看是否还可以...
2014-10-24 14:37:00
86
转载 uva 131
题目大意:手上有5张牌, 堆上有5张牌, 现在要求舍弃手上的n(0<=n<=5)牌, 从堆的面上拿n张牌, 假设了你有特异功能, 可以知道堆上的5张牌从上到下是是什么, 要求最后得到的牌要面值最大, 一张牌由数字与花色组成。straight-flush 同花顺:一手同花的五张牌 + 五张牌点数连续的顺子four-of-a-kind 四张相同 的牌full...
2014-10-23 13:47:00
134
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人