摘要: 本题我暂时没有好的解法,自想到把他们枚举,然后一个一个试就可以了 输入受限的双端队列不可以得到:4213、4231 输出受限的双端队列不可以得到:4132、4231 阅读全文
posted @ 2016-10-16 18:59 KennyRom 阅读(3903) 评论(0) 推荐(0) 编辑
摘要: //queue STL //queue is just a container adaptor, which is a class that use other container. //just like stack q1.push(x) //push x into the queue q1.pop() //pop the first element in the que... 阅读全文
posted @ 2016-10-13 15:38 KennyRom 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1. Definiation What is a queue? A queue is a list. With a queue, inseration is done at one end (known as rear) whereas deletion is performed at the ot 阅读全文
posted @ 2016-10-13 10:39 KennyRom 阅读(195) 评论(0) 推荐(0) 编辑
摘要: //Stack STL //在STL中,栈是以别的容器作为底部结构,再将 //接口改变,使之符合栈的特性 //一共5个常用操作函数 //构造析构 stackc; //build a empty stack stackc1(c2); //copy a stack //5 functions c.top(); //return the element at the top... 阅读全文
posted @ 2016-10-12 21:00 KennyRom 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 描述: 新活有个舞蹈室,并且只有一个舞蹈室,假设申请时间以小时为单位,每天24个小时,每周就是168小时,我们规定申请时间从每周一的0点开始递增,比如申请时间区间为【1,24】就代表周一的0点到24点,时间区间【25,48】就代表周二的0点到24点,以此类推。 现在假定你是舞蹈室的管理人员,面对一批 阅读全文
posted @ 2016-10-12 00:21 KennyRom 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main() { listl1, l2, l3; string s1, s2; cin >> s1; cin >> s2; //储存大数 for (int i = 0; i::iterator it1, it2; it1 = l1.begin(); it2 = l2.beg... 阅读全文
posted @ 2016-10-11 23:47 KennyRom 阅读(295) 评论(0) 推荐(0) 编辑
摘要: //List容器 //List本质是一个双向链表 //构造函数 listc0; //空链表 listc1(3); //建一个含三个默认值是0的元素链表 listc2(5,2); //含5个元素,值都是2 listc4(c2); //复制链表 listc5(c1.begin(), c1.end()); //c5包含c1的一个区域元素 //成员函... 阅读全文
posted @ 2016-10-11 20:35 KennyRom 阅读(215) 评论(0) 推荐(0) 编辑
摘要: //自己造容器--List /* 1、iterator 2、头迭代器 3、尾迭代器 4、链表长 5、判空 6、清除 7、取头元素 8、取尾元素 9、头插入 10、尾插入 11、头删除 12、尾删除 13、插入函数 14、删除函数 */ template class List { private: //结点 struct Node { Object data; Node *prev... 阅读全文
posted @ 2016-10-11 14:53 KennyRom 阅读(144) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; const int size = 50; int main() { string s1, s2; cin >> s1 >> s2; int len = (s1.length()>s2.length()) ? s1.length() : s2.length(); int a1[size] = { 0 }; ... 阅读全文
posted @ 2016-10-09 00:24 KennyRom 阅读(1197) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; template struct Node { Type data; Node*next; }; template class Stack { private: Node*head; public: //构造函数 Stack() { head = new Node; head->next = NU... 阅读全文
posted @ 2016-10-08 23:45 KennyRom 阅读(142) 评论(0) 推荐(0) 编辑