自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (11)
  • 收藏
  • 关注

空空如也

pku 1063 Flip and Shift

This puzzle consists of a random sequence of m black disks and n white disks on an oval-shaped track, with a turnstile capable of flipping (i.e., reversing) three consecutive disks. In Figure 1, there are 8 black disks and 10 white disks on the track. You may spin the turnstile to flip the three disks in it or shift one position clockwise for each of the disks on the track The goal of this puzzle is to gather the disks of the same color in adjacent positions using flips and shifts. You are to write a program which decides whether a given sequence can reach a goal or not. If a goal is reachable, then write a message "YES"; otherwise, write a message "NO". Input The input consists of T test cases. The number of test cases ) (T is given in the first line of the input file. Each of the next T lines gives a test case. A test case consists of an integer, representing the sum of m and n, and a sequence of m+n 0s and 1s, representing an initial sequence. A 0 denotes a white disk and a 1 denotes a black disk. The sum of m and n is at least 10 and does not exceed 30. There is a space between numbers. Output The output should print either "YES" or "NO" for each test case, one per line. Sample Input

2010-05-04

高质量C++/C编程指南.pdf

清晰版的《高质量C++/C编程指南》,非常有用对于学计算机的同学来说

2010-04-22

2140 Herd Sums

The cows in farmer John's herd are numbered and branded with consecutive integers from 1 to N (1 <= N <= 10,000,000). When the cows come to the barn for milking, they always come in sequential order from 1 to N. Farmer John, who majored in mathematics in college and loves numbers, often looks for patterns. He has noticed that when he has exactly 15 cows in his herd, there are precisely four ways that the numbers on any set of one or more consecutive cows can add up to 15 (the same as the total number of cows). They are: 15, 7+8, 4+5+6, and 1+2+3+4+5. When the number of cows in the herd is 10, the number of ways he can sum consecutive cows and get 10 drops to 2: namely 1+2+3+4 and 10. Write a program that will compute the number of ways farmer John can sum the numbers on consecutive cows to equal N. Do not use precomputation to solve this problem.

2010-04-01

ElGamal Signature(数字签名)

ElGamal Signature(数字签名) 信息安全基础实习

2010-01-08

中国剩余定理(CRT)

中国剩余定理求同余方程式 x=b1(mod m1) x=b2(mod m2) …… x=bn(mod mn)

2010-01-08

c++实现唯一可译码

c++实现唯一可译码,信息论与编码,信息安全实习

2010-01-08

哈夫曼编码Huffman

哈夫曼编码 信息论与编码 信息安全基础实习 适用

2010-01-08

怎样计算命题公式的真值

所谓命题演算公式是指由逻辑变量(其值为TRUE或FALSE)和逻辑运算符∧(AND)、∨(OR)和┐(NOT)按一定规则所组成的公式(蕴含之类的运算可以用∧、∨和┐来表示)。公式运算的先后顺序为┐、∧、∨,而括号()可以改变优先次序。已知一个命题演算公式及各变量的值,要求设计一个程序来计算公式的真值。 1.利用二叉树来计算公式的真值。首先利用堆栈将中缀形式的公式变为后缀形式;然后根据后缀形式,从叶结点开始构造相应的二叉树;最后按后序遍历该树,求各子树之值,即每到达一个结点,其子树之值已经计算出来,当到达根结点时,求得的值就是公式之真值。 2.逻辑变元的标识符不限于单字母,而可以是任意长的字母数字串。

2009-07-17

迷宫问题——求一条通路

以一个m*n的长方阵表示迷宫,0和1分别表示迷宫中的通路和障碍。设计一个程序,对任意设定的迷宫,求出一条从入口到出口的通路,或得出没有通路的结论。 1.首先实现一个以链表作存储结构的栈类型,然后编写一个求解迷宫的非递归程序。求得的通路以三元组(i,j,d)的形式输出,其中(i,j)指示迷宫中的一个坐标,d表示走到下一坐标的方向。 2.测试几组数据,数据的规模由小变大,即网格越来越小,障碍越来越复杂。

2009-07-17

求关键路径的c语言程序设计

当一项工程被划分为若干个子任务或活动后,人们不仅需要确定这些活动的先后次序,而且需要进一步计算完成整个工程的时间,确定哪些活动是影响工程进度的关键活动,以便合理组织人力、物力、财力,加快这些活动的进度,为按时或提前完成整个工程提供保证。 1.完成整项工程至少需要多少时间? 2.哪些活动是影响工程进度的关键?

2009-07-17

空空如也

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

TA关注的人

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