- 博客(80)
- 收藏
- 关注
转载 进程与线程的区别 进程的通信方式 线程的通信方式
进程与线程的区别进程的通信方式线程的通信方式2011-03-15 01:04进程与线程的区别:通俗的解释一个系统运行着很多进程,可以比喻为一条马路上有很多马车不同的进程可以理解为不同的马车而同一辆马车可以有很多匹马来拉--这些马就是线程假设道路的宽度恰好可以通过一辆马车道路可以认为是临界资源那么马车成为分配资源的最小单位(进程)而
2016-09-26 19:32:17
306
原创 ...
#include#include#include#define MAX 70#includeusing namespace std;//实现dig1和dig2的字符串加法,结果更新dig1//返回true运算成功,返回false说明得到的字符串长度大于lenbool AddSelfOnce(char dig1[],char dig2[],int len);char
2015-07-09 18:18:35
303
原创 JAVA中String类
String : 字符串类型一、构造函数 String(byte[ ]bytes):通过byte数组构造字符串对象。 String(char[ ] value):通过char数组构造字符串对象。 String(Sting original):构造一个original的副本。即:拷贝一个original。 String(StringBuff
2015-07-09 16:10:58
310
原创 Is It A Tree?
DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following proper
2015-02-06 16:23:45
381
原创 Help him
DescriptionAs you know, when you want to hack someone's program, you must submit your test data. However sometimes you will submit invalid data, so we need a data checker to check your data. Now sma
2015-02-06 16:08:17
408
原创 Being a Good Boy in Spring Festival(Nim博弈)
Description一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧 陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地做回早餐 如果愿意 你还可以和爸妈说 咱们玩个小游戏吧 ACM课上学的呢~ 下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=
2015-02-02 17:41:42
303
原创 How many ways(记忆化搜索)
Description这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下:1.机器人一开始在棋盘的起始点并有起始点所标有的能量。 2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。 3.机器人不能在原地停留。 4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。
2015-02-02 16:23:01
393
原创 搬寝室
Description搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品
2015-02-02 15:15:45
255
原创 最大连续子序列
Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ...,Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该
2015-02-01 18:23:11
261
原创 博弈论-取石子问题
有一种很有意思的游戏,就是有物体若干堆,可以是火柴棍或是围棋子等等均可。两个人轮流从堆中取物体若干,规定最后取光物体者取胜。这是我国民间很古老的一个游戏,别看这游戏极其简单,却蕴含着深刻的数学原理。下面我们来分析一下要如何才能够取胜。(一)巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。最后取光者得胜。
2015-02-01 14:51:35
644
原创 不要62(数位DP)
Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2
2015-01-30 14:37:31
320
原创 windy数(数位DP)
Descriptionwindy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间,包括A和B,总共有多少个windy数?Input包含两个整数,A B。Output一个整数。Sample Input【输入样例
2015-01-30 13:32:57
391
原创 Bribing FIPA(树形DP)
DescriptionThere is going to be a voting at FIPA (Fédération Internationale de Programmation Association) to determine the host of the next IPWC (International Programming World Cup). Benj
2015-01-29 18:41:24
414
原创 Round and Round We Go
DescriptionA cyclic number is an integer n digits in length which, when multiplied by any integer from 1 to n, yields a"cycle"of the digits of the original number. That is, if you consider the
2015-01-29 18:37:20
267
原创 A Simple Problem with Integers
DescriptionYou 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. Th
2015-01-29 17:04:53
272
原创 A计划
Description可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主
2015-01-29 16:29:59
376
原创 Train Problem I
DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fas
2015-01-29 16:24:58
278
原创 小希的迷宫
Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。
2015-01-29 16:03:53
506
2
原创 More is better(并查集)
DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex,the more boys come, the better it will be. Of course there are certain requirements.
2015-01-29 14:51:15
260
原创 Rescue
Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M Angel's friends want to save Angel. Their task is: approach Ange
2015-01-28 14:43:39
302
原创 畅通工程NO.3
Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米
2015-01-28 14:15:26
330
原创 A Game Between Alice and Bob
DescriptionAlice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the numbers, and replace it with one of its posit
2015-01-26 19:18:06
678
原创 整数划分
题目描述:整数划分是一个经典的问题,希望这道题对你的组合数学有所帮助. 提示 1. 将5划分成若干正整数之和的划分为: 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1, 1+1+1+1+1 2. 将5划分成2个正整数之和的划分为: 3+2, 4+1 3. 将5划分成最大数不超过2的划分为: 1+1+1+1+1, 1+1+1+2, 1+2+2 4.
2015-01-26 15:48:40
335
原创 Common Subsequence(最长公共子序列)
DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exi
2015-01-25 12:01:06
289
原创 Brackets Sequence
DescriptionLet us define a regular brackets sequence in the following way:1. Empty sequence is a regular sequence. 2. If S is a regular sequence, then (S) and [S] are both regular se
2015-01-24 15:30:28
729
原创 To the Max
DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a re
2015-01-24 12:42:30
248
原创 Dungeon Master
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move
2015-01-23 20:22:55
311
原创 推箱子
Description推箱子是一个很经典的游戏.今天我们来玩一个简单版本.在一个M*N的房间里有一个箱子和一个搬运工,搬运工的工作就是把箱子推到指定的位置,注意,搬运工只能推箱子而不能拉箱子,因此如果箱子被推到一个角上(如图2)那么箱子就不能再被移动了,如果箱子被推到一面墙上,那么箱子只能沿着墙移动.现在给定房间的结构,箱子的位置,搬运工的位置和箱子要被推去的位置,
2015-01-23 14:55:38
866
原创 数独
#include#include#include#include#include/* 构造完成标志 */int sign; //0代表false,1代表true/* 创建数独矩阵 */int num[9][9];/* 函数声明 */void Input();void Output();int Check(int n, int key);//返回0代表fals
2015-01-23 13:26:52
487
原创 Battle City
DescriptionMany of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now.What we are discussing is a simple edition of t
2015-01-22 11:00:18
359
原创 翻纸牌游戏
Problem Description有一种纸牌游戏,很有意思,给你N张纸牌,一字排开,纸牌有正反两面,开始的纸牌可能是一种乱的状态(有些朝正,有些朝反),现在你需要整理这些纸牌。但是麻烦的是,每当你翻一张纸牌(由正翻到反,或者有反翻到正)时,他左右两张纸牌(最左边和最右边的纸牌,只会影响附近一张)也必须跟着翻动,现在给你一个乱的状态,问你能否把他们整理好,使得每张纸牌都正面朝上,如果可以
2015-01-22 10:42:45
463
原创 Dearboy's Puzzle
DescriptionDearboy is a game lover. Recently, he loves playing the game Lian Lian Kan. This game is played on a board with N*M grids, and lots of cards are put on the board in the grids. You
2015-01-21 22:06:58
348
原创 The Game
DescriptionOne morning, you wake up and think: "I am such a good programmer. Why not make some money?'' So you decide to write a computer game.The game takes place on a rectangular board
2015-01-21 16:14:18
298
原创 Stealing Harry Potter's Precious
Description Harry Potter has some precious. For example, his invisible robe, his wand and his owl. When Hogwarts school is in holiday, Harry Potter has to go back to uncle Vernon's home. Bu
2015-01-21 12:41:42
396
原创 Last non-zero Digit in N!
DescriptionThe expression N!, read as "N factorial," denotes the product of the first N positive integers, where N is nonnegative. So, for example,N N! 0 1 1 1 2 2 3 6 4 24 5
2015-01-21 10:35:51
243
原创 Square
DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square? InputThe first line of input contains N, the number of test c
2015-01-21 00:19:42
266
原创 魔方矩阵
输入一奇数n(nn*n构成的魔方矩阵。 魔方矩阵的行列及对角线的和都相等。输入描述:输入一奇数n(n输出描述:打印出1->n*n构成的魔方矩阵,每一个数据之间用一个空格隔开,但每行的最后一个数据后不能有空格.所有输出的最后一行不能有回车样式输入:3样式输出:8 1 6 3 5 7
2014-12-17 19:38:24
1042
原创 看病候诊(队列)
#include#include#includeusing namespace std;class T{public: int y,z; T(int b,int c):y(b),z(c) { }};bool operator<(const T&t1,const T&t2){ if(t1.z!=t2.z) return t1.z<t2.z;
2014-12-17 18:06:37
924
原创 最长公共子串
#include#include#include#includeusing namespace std;const int MAX = 300;char a[MAX],b[MAX];void c(char *str1, char *str2){ int i,j,k,len1,len2,mm,x,y; len1 = strlen(str1); len2 = s
2014-12-17 17:54:29
287
原创 Andrey and Problem
DescriptionAndrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andre
2014-12-14 20:10:23
507
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人