#include
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char chars[]);
int get_next(HString T,int next[]);
void main()
{ HString T;
char chars[80];
in...
分类:
其他好文 时间:
2014-08-01 13:51:23
阅读次数:
229
分布式架构是中心化的设计,就是一个主控机连接多个处理节点,因此保证主控机高可用性十分关键.分布式锁是解决该问题的较好方案,多主控机抢一把锁.Zookeeper就是一套分布式锁管理系统,用于高可靠的维护元数据....
分类:
其他好文 时间:
2014-08-01 13:50:51
阅读次数:
230
1.3 HSB模式及其与RGB间的转换
从上两节的讨论可知,RGB模式是一个数理性质较强的概念,对于大部分色彩来说,您很难通过RGB的数值得知它代表什么颜色,以及它的明暗和鲜艳程度。
《忆江南》的景观之所以能直接用最简单的三原色来渲染,完全是因为他所描绘的江南美景足够的清澈纯净,而且颜色的种类较少。
实际上,大多数情况下,颜色的种类远不止红绿蓝...
分类:
其他好文 时间:
2014-08-01 13:50:41
阅读次数:
160
#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct //定义字符栈
{ int *base;
int *top;
int stacksize;
}SqStack;
void InitStack(SqStack &S); //初始化一...
分类:
其他好文 时间:
2014-08-01 13:50:31
阅读次数:
237
n个数,找到两个下标i和j(i < j),在1-i中选取若干个数的异或值等于在j-n中选取若干个数的按位与值,两个集合都非空,求满足条件的集合数有多少...
分类:
其他好文 时间:
2014-08-01 13:50:11
阅读次数:
194
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char *chars);
void StrLength(HString S);
void StrCompare(HString S,HString T);
void ClearString(HString &S...
分类:
其他好文 时间:
2014-08-01 13:50:01
阅读次数:
123
#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct
{//构造栈的数据类型
int *base;
int *top;
int stacksize;
}SqStack;
void CreateStack(SqStack &S);//初始化一个栈
void PushS...
分类:
其他好文 时间:
2014-08-01 13:49:41
阅读次数:
187
UVA 1328 - Period
题目链接
题意:给定一个字符串,求出有几个位置的前缀串是由个数大于1的串循环得到的,求出位置和循环次数
思路:利用kmp的next数组的性质,i - next[i]就是循环长度,然后判断一下是不是正好是倍数即可
代码:
#include
#include
const int N = 1000005;
int n, next[...
分类:
其他好文 时间:
2014-08-01 13:49:11
阅读次数:
171
题意:第一排输入n(货币的种类) m(兑换货币的站点数) t(你现在拥有的货币是第几类货币) v(你现在拥有多少该类货币)
下面每行输入的数:a b 就是a兑换b rab 兑率 cab (手续费) rba 同样的意思 (ab表示a 兑换 b)
问t币的金额经过交换最终得到的t币金额数能否增加
思路:寻找正环 果断bellman_ford算法 寻找最长的路,...
分类:
其他好文 时间:
2014-08-01 13:49:01
阅读次数:
182
就多个等于号纠结死
先按di排序,(从小到大)。然后依次完成合同,若发现第i个合同无法在截止日期前完成,便从之前已经完成的任务中选一个aj最大的合同,付钱来使得这个合同尽快完成。
#include
#include
#include
#include
#include
using namespace std;
struct node
{
int q;
in...
分类:
其他好文 时间:
2014-08-01 13:48:41
阅读次数:
239
1.3.1 HSB模式的色彩空间模型及其分支
第一次接触HSB模式的原理,是从以下这个地址开始的。
http://zh.wikipedia.org/wiki/HSL%E5%92%8CHSV%E8%89%B2%E5%BD%A9%E7%A9%BA%E9%97%B4
图1.21是我从上面的文章拷过来的一张色彩空间示意图,可见HSB在业界至少还可以...
分类:
其他好文 时间:
2014-08-01 13:48:31
阅读次数:
202
问题描述:
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
解题思路:...
分类:
其他好文 时间:
2014-08-01 13:48:11
阅读次数:
183
Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows....
分类:
其他好文 时间:
2014-08-01 13:48:01
阅读次数:
280
在c#中要扩展一个现有类很容易,比如这样:
?
1
2
3
4
5
6
7
public static class Utils
{
public static void PrintToConsole(this string strSrc)
{
Con...
分类:
其他好文 时间:
2014-08-01 13:47:51
阅读次数:
296
二叉树主要有三种遍历方式:前序遍历、中序遍历和后序遍历,每种方式都有递归和非递归两种方法。递归的方法简单明了,但是会比较耗时,非递归的方法效率相对较高,但是算法也比较晦涩。本文就这三种遍历方式做简单的介绍。...
分类:
其他好文 时间:
2014-08-01 13:47:41
阅读次数:
223