Description监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱Input输入两个整数M,N.1#includeusing namespace std;long long ...
分类:
其他好文 时间:
2015-04-06 21:28:23
阅读次数:
206
/*
*Copyright (c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:d.cpp
*作 者:张旺华
*完成日期:2015年4月6日
*版 本 号:v1.0
*/
#include
using namespace std;
class myClass
{
public:
myClass(){ numb...
分类:
其他好文 时间:
2015-04-06 20:24:41
阅读次数:
142
这个题目就是求一个序列的第k个字典序排序,因为k比较大所以我们不能穷举,而是用其它的方法求。代码如下:#include
#include
#include
using namespace std;#define ll long longchar str[20];
int cc[30];
ll fac[20],k;ll GetNum(int cnt...
分类:
其他好文 时间:
2015-04-06 20:19:16
阅读次数:
121
#include#includeusing namespace std;class sales_item{ friend istream& operator>>(istream &,sales_item&); friend ostream& operator<<(ostream&,const sal...
分类:
其他好文 时间:
2015-04-06 20:10:43
阅读次数:
135
#include#includeusing namespace std;class sales_item{ friend istream& operator>>(istream &,sales_item&); friend ostream& operator>(istream& ism,sales_...
分类:
其他好文 时间:
2015-04-06 20:06:17
阅读次数:
123
#include
using namespace std;
int main(int argc, char* argv[])
{
char* str1 = "hello";
char* str2 = "china";
char* str3 = NULL;
str3 = new char[strlen(str1) + strlen(str2) + 1];
str3[0] = '\n...
分类:
其他好文 时间:
2015-04-06 18:50:09
阅读次数:
110
main.cpp
#include
#include "header.h"
using namespace std;
int main()
{
CPoint X(2,5),Y(5,2),Z(7,8);
CTriangle Tri1(X,Y,Z);
cout<<"该三角形的周长为:"<<Tri1.perimeter()<<",面积为:"<<Tri1.area()<<...
分类:
其他好文 时间:
2015-04-06 17:23:00
阅读次数:
184
#include #include#includeusing namespace std;//智能指针的使用//智能指针类class U_ptr{ friend class hashptr; int *ip;//在hashptr中实际的需要定义的指针成员 size_t use;//使用次数的计数 U...
分类:
其他好文 时间:
2015-04-06 17:12:42
阅读次数:
163
#include#include#include #include #include using namespace std;//朴素模式匹配void Naive_String_Matcher(string T, string P){ int n = T.length(); int m ...
分类:
其他好文 时间:
2015-04-06 17:08:20
阅读次数:
154
#include #include#includeusing namespace std;//定义值类型/*复制构造函数不再复制指针,它将分配一个新的 int 对象,并初始化该对象以保存与被复制对象相同的值。每个对象都保存属于自己的 int 值的不同副本。因为每个对象保存自己的副本,所以析构函数将无...
分类:
其他好文 时间:
2015-04-06 17:02:29
阅读次数:
161