- 博客(163)
- 资源 (1)
- 收藏
- 关注
转载 优雅的关闭socket
http://blog.sina.com.cn/s/blog_4dbcd2730100v5cu.html转载于以上网址我们在利用IOCP(完成端口)进行程序设计的时候,经常要关闭一些不满足条件的套接字。假如我们直接采用closesocket方法进行关闭的话,绑定到IO端口的此套接字的未发送的数据就会丢失,这种情况是我们不愿意发生的。下面介绍一种合理关闭此套接字的方法: 首先,利用setsockop...
2018-03-07 10:28:59 723
原创 win32下利用FindFirstFile与FindNextFile遍历全盘文件
#include#include#includeWIN32_FIND_DATA findData;char d[MAX_PATH];void findall(HANDLE aim){ while (FindNextFile(aim, &findData)) { if (strcmp(findData.cFileName, ".") == 0 || strcmp(findData
2018-01-22 08:13:56 965
原创 E. Mishka and Divisors Codeforces Round #365 (Div. 2) 01背包
E. Mishka and Divisorstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter playing with her beautiful array, Mishka
2017-11-28 18:29:18 378
原创 小Z的袜子(hose) HYSBZ - 2038 莫队算法
作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。你的任务便是告诉小Z,他有多大的概率抽到两只颜色相
2017-11-23 16:21:58 408
原创 Magina HDU - 3810 dfs+01背包队列模拟
Magina, also known as Anti-Mage, is a very cool hero in DotA (Defense of the Ancient).If you have no idea of him, here is some brief introduction of his legendary antecedents:Twin sons to
2017-11-22 21:11:51 405
原创 HDU 3449 Consumer 依赖背包
FJ is going to do some shopping, and before that, he needs some boxes to carry the different kinds of stuff he is going to buy. Each box is assigned to carry some specific kinds of stuff (that is to s
2017-11-21 16:45:24 142
原创 I love sneakers! HDU - 3033 分组01背包 好题!
After months of hard working, Iserlohn finally wins awesome amount of scholarship. As a great zealot of sneakers, he decides to spend all his money on them in a sneaker store.There are sever
2017-11-20 19:37:47 338
原创 ACboy needs your help HDU - 1712 裸分组背包
ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrange the M days for
2017-11-17 21:59:42 441
原创 HDU 1671 Phone List 字典树
Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:1. Emergency 911 2. Alice 97
2017-11-17 21:26:51 293
原创 The more, The Better HDU - 1561 树形dp,依赖背包
ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗?Input 每个测试实例首先包括2个整数,N,M.(1 = 0。当N = 0, M = 0输入结束
2017-11-17 19:12:24 240
原创 Dividing HDU - 1059 完全背包
Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same v
2017-11-16 14:37:02 342
原创 D - Restoration of string 图论,拓扑序
D. Restoration of stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA substring of some string is called the mos
2017-11-14 11:11:27 276
原创 String painter HDU - 2476 好几天都无法理解的区间dp
There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a segment of chara
2017-11-14 10:25:12 465
原创 Food Delivery ZOJ - 3469 区间dp
When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.Suppose there are N people livin
2017-11-12 16:17:36 156
原创 Multiplication Puzzle POJ - 1651 区间dp
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points equal to the pr
2017-11-11 08:28:28 297
原创 Coloring Brackets CodeForces - 149D 区间dp
Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.You are given string s. It represents a correct bracket sequence. A cor
2017-11-10 19:43:20 167
原创 Brackets POJ - 2955 区间dp
We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,if s is a regular brackets sequence, then (s) and [s] are regular brac
2017-11-09 20:32:17 289
原创 Halloween Costumes LightOJ - 1422 区间dp
Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume parties, Gap
2017-11-09 16:45:17 291
原创 Cake ZOJ - 3537 区间dp,凸多边形最优三角形剖分
You want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The trace of each cu
2017-11-09 11:42:10 408
原创 Turing Tree hdu 3333(传说中的图灵树)
Turing TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5934 Accepted Submission(s): 2118Problem DescriptionAfter inventing Tu
2017-11-07 21:54:52 831
原创 Play with Chain HDU - 3487 splay区间翻转,区间位移
YaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the diamonds on the chain is a sequence: 1, 2, 3, …, n. He will perf
2017-11-04 15:59:13 277
原创 Robotic Sort HDU - 1890 splay区间翻转
Somewhere deep in the Czech Technical University buildings, there are laboratories for examining mechanical and electrical properties of various materials. In one of yesterday’s presentations, you hav
2017-11-04 15:54:35 312
原创 I Hate It HDU - 1754 伸展树
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。 第二
2017-11-03 15:46:26 277
原创 A Simple Problem with Integers POJ - 3468 splay/线段树
You have N integers, A1, A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the
2017-11-02 15:00:23 243
原创 Danil and a Part-time Job codeforces dfs序,线段树
Danil and a Part-time Jobtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDanil decided to earn some money, so he had f
2017-11-01 09:03:34 319
原创 Teams Formation CodeForces - 878B 思维
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus hasn passenger seats, seat i can be occupied only by a participant from t
2017-10-31 09:19:26 298
原创 1861: [Zjoi2006]Book 书架
1861: [Zjoi2006]Book 书架Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 1822 Solved: 1038[Submit][Status][Discuss]Description小T有一个很大的书柜。这个书柜的构造有些独特,即书柜里的书是从上至下堆放成一列。她用1到n的正整数给每本书都编了号。 小T在看
2017-10-24 20:28:24 218
原创 Pick The Sticks HDU - 5543 变形01背包
The story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his point and all became very panic. However, Cao Cao himself felt very proud of hi
2017-10-24 18:39:22 359
原创 1208: [HNOI2004]宠物收养所 伸展树
1208: [HNOI2004]宠物收养所Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 9732 Solved: 3892[Submit][Status][Discuss]Description最近,阿Q开了一间宠物收养所。收养所提供两种服务:收养被主人遗弃的宠物和让新的主人领养这些宠物。每个领养者都希望领养到自己满意
2017-10-20 10:42:16 210
转载 伸展树 模板(指针+数组)
转载自:http://blog.csdn.net/leolin_/article/details/6436037#include using namespace std;#define MAXN 100010struct Node{ int key, sz, cnt; Node *ch[2], *pnt;//左右儿子和父亲 Node(){} Node(in
2017-10-17 10:51:32 337
原创 1588: [HNOI2002]营业额统计
Description营业额统计 Tiger最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况。 Tiger拿出了公司的账本,账本上记录了公司成立以来每天的营业额。分析营业情况是一项相当复杂的工作。由于节假日,大减价或者是其他情况的时候,营业额会出现一定的波动,当然一定的波动是能够接受的,但是在某些时候营业额突变得很高或是很低,这就证明公司此时
2017-10-17 10:42:37 312
原创 Work Scheduling URAL - 1099 一般图的最大匹配(带花树)
做了很多二分图了,但是给出的都是没有环的,如果有了环,就不能转化为二分图。所以这就需要一个全新的算法,带花树算法;反正也看不懂,直接套板子把/* ***********************************************Author :kuangbinCreated Time :2013/8/21 22:56:05File Name :
2017-10-08 10:58:17 390
原创 Tour HDU - 3488 最大权匹配
In the kingdom of Henryy, there are N (2 <= N <= 200) cities, with M (M <= 30000) one-way roads connecting them. You are lucky enough to have a chance to have a tour in the kingdom. The route should b
2017-10-08 10:52:08 339
原创 奔小康赚大钱 HDU - 2255 最大权匹配
传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。 这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子在
2017-10-08 10:49:50 492
原创 Cat VS Dog HDU - 3829 最大独立集
The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child's like-animal is a cat, then his/hers dislike-animal must b
2017-10-08 10:41:48 360
原创 Treasure Exploration POJ - 2594 最小路径覆盖
Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you would never know
2017-10-08 10:33:24 327
原创 Air Raid HDU - 1151 最小路径覆盖
Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets you can
2017-10-08 10:25:20 249
原创 Strategic Game HDU - 1054 二分图最小点覆盖
Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must defend a medieva
2017-10-08 10:19:12 309
原创 Antenna Placement POJ - 3020 二分图最小路径覆盖
The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of a new
2017-10-08 10:14:03 288
原创 Oil Skimming HDU - 4185 二分匹配重要思想 双向图转换为单向图
Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by e
2017-10-08 10:01:05 409
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人