码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
南阳理工--21--三个水杯~~广度优先搜索
这一题运用广度优先搜索可以解决,主要是各个状态的转移以及某个状态出现过要标记,避免重复,进入死循环。 下面是AC代码,上面有详细的讲解: # include # include # include using namespace std; class data //队列的结点, { public: int water[3]; ...
分类:其他好文   时间:2015-04-09 08:53:22    阅读次数:118
每日一题18:栈
用C++写了一个栈模板,其间用了一些《Effective C++》的准则,记录在这里喽。这个类还没有做到异常安全,以后改进! Stack.h文件。#ifndef _STACK_H_ #define _STACK_H_namespace MyDataStructure { template class Stack { private:...
分类:其他好文   时间:2015-04-09 08:50:42    阅读次数:117
二分查找分C++实现
#include using namespace std; /* 二分查找法 优点:查找速度快,平均性能好。 缺点:待查表为有序表  */ int main() { int binSearch(const int*, int, int, int);  int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cout   return ...
分类:编程语言   时间:2015-04-09 01:02:06    阅读次数:152
poj 3286 How many 0's? 按位统计
题意: 给m 分析: 按位算当某位是0时左边有多少种情况,右边有多少种情况,注意左边的情况数为-1时(这时遍历到最高位)是为了把右边多加的情况减去,也就是把0作为开头时的情况减去。 代码: //poj 3286 //sep9 #include using namespace std; typedef __int64 ll; ll b[16]; ll f(ll n) { ll left...
分类:其他好文   时间:2015-04-09 01:01:52    阅读次数:118
堆栈链表储存
//堆栈,链表实现#includeusing namespace std;class stack{public: int data; stack*next; };stack*Linkstack(){ stack*s = new stack; s->next = NULL; //生成...
分类:其他好文   时间:2015-04-09 00:50:22    阅读次数:103
用B-树实现虚拟图书管理系统
学校数据结构的课程实验之一。用到的数据结构:B-树基本功能:对虚拟书库的图书进行查看、增加、删除、修改。主函数:#include #include "Library.h"using namespace std;int main(){ Library myLib=Library("books.t...
分类:其他好文   时间:2015-04-09 00:47:00    阅读次数:269
今年暑假不AC
贪心基本题, 有助于理解贪心算法的思想#include #include using namespace std;struct Program{ int begin, end;} programs[100];/** 贪心: 贪心算法的基本步骤 :* 1、从问题的某个初始解出发。* 2、采用循环语句....
分类:其他好文   时间:2015-04-09 00:44:00    阅读次数:141
可空类型
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Nullable;namespace 可空类型{ ....
分类:其他好文   时间:2015-04-09 00:40:31    阅读次数:123
历届试题 错误票据
#include #include #include #include #include using namespace std; #define mem(A) memset(A,0,sizeof(A)) #define N 10000010     int arr[10010]; int main() {                           int...
分类:其他好文   时间:2015-04-08 23:28:48    阅读次数:482
每日一题19:循环队列
基于数组实现的循环队列,这个比基于链表实现的稍微麻烦一点,需要浪费一个存储空间。如果全部利用,则编程将会变得更加繁琐,并且更容易出错。// LoopQueue.cpp : 定义控制台应用程序的入口点。 //#include "stdafx.h" #include using namespace std;struct loop_queue { int capacity;...
分类:其他好文   时间:2015-04-08 23:24:40    阅读次数:202
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!