汉诺塔问题学习心得(始终保持大盘在下,小盘在上):
void Hanoi(int n, int A, int B,int C) // 规则:将A的盘子从大到小的移动到B上,并以C为辅助
{
if ( n > 0 )
{
Hanoi(n-1,A,C,B); // 将A上移动到C上,以B为辅助
Move(n,A,B); // 将A上的编号为n的盘子(即要求的最大的盘子)移动到B(最终目标)上
Hanoi(n-1,C,B,A); // C -> B,以A为辅助
}
}
阅读全文
Problem Description
A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words in a dictionary.
Input
Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 50,000 words. Only one case.
Output
Your output should contain all the hat’s words, one per line, in alphabetical order.
Sample Input
a
ahat
hat
hatword
hziee
word
Samp......
阅读全文
初次安装使用SQL server 2008 R2时,遇到无法连接到(local)的情况,如下:
解决办法:
打开SQL server 配置管理器-->SQL server 网络配置-->实例名的协议(我的实例名为SQLEXPRESS)。
将上图中的SQLEXPRESS协议中的Named Pipes和 TCP/IP启用。
点击SQL Server服务,将SQL Server(SQLEXPRESS)重新启动。
重新打开SQL Server Management Studio ,服务器类型选择数据库引擎,服务器名称填(local)\实例名 或者计算机名\实例名 (计算机名为你的计算机名称,实例名一般为SQLEXPRESS或者安装SQL时创建的实例名),身份验证选......
阅读全文