码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
数组名和指针的深入理解(C++)
指针是C/C++语言的特色,而数组名与指针有太多的相似,甚至很多时候,数组名可以作为指针使用。于是乎,很多程序设计者就被搞糊涂了。魔幻数组名请看程序(本文程序在WIN32平台下编译):#include using namespace std;int main(){ char str[10]; ...
分类:编程语言   时间:2015-09-01 10:41:26    阅读次数:180
Bellman算法模板
1 #include 2 #include 3 #include 4 using namespace std; 5 const int inf=1d[e[j].from]+e[j].c)27 d[e[j].to]=d[e[j].from]+e[j].c;28 ...
分类:编程语言   时间:2015-09-01 10:39:36    阅读次数:202
Dijkstra算法模板
#include #include #include using namespace std;const int inf=1d[j])//vis避免前面已经比过了的最小值的点重复比较 { //一直找出此时离起点最近的点,以此点为基础,向下找其他点到...
分类:编程语言   时间:2015-09-01 09:12:51    阅读次数:194
hihoCoder 1225 向日葵(凸包)
题目链接:hihoCoder 1225 向日葵 枚举每条线段称为凸包边界的概率。注意一对点中有1个在线段左边*0.5,0个在线段左边*0,2个都在线段左边*1。最后答案要除4,因为枚举的两个点也要算概率。 #include #include #include #include #include #include using namespace std; typed...
分类:其他好文   时间:2015-09-01 01:51:54    阅读次数:171
zoj 3871 Convex Hull(凸包)
题目链接:zoj 3871 Convex Hull 枚举每条边,计算出有多少情况下为凸包的边界,即有多少点在该边的左边。 #include #include #include #include #include #include using namespace std; typedef pair pii; typedef long long ll; const d...
分类:其他好文   时间:2015-09-01 01:51:04    阅读次数:269
hdu 5425 Rikka with Tree II(暴力)
题目链接:hdu 5425 Rikka with Tree II 直接枚举就好了,当概率极小时贡献值可以忽略。 #include #include #include #include #include #include using namespace std; const int maxn = 1e5 + 5; int N, D[maxn]; vector G...
分类:其他好文   时间:2015-09-01 01:49:54    阅读次数:187
笔试题:乱序求第n大(小)的数。我能想到的最好的方法。
#include using namespace std; //当然用快速排序也是一样的。 class Heap { public: Heap(){} void Insert(int a[],int len,int N) { data = new int[N]; size = N; for(int i=0;i<N;i++) { data[i]=a[i]; } ...
分类:其他好文   时间:2015-09-01 01:48:25    阅读次数:168
笔试题:用两个栈实现队列
#include #include using namespace std;template class QUEUE { public: QUEUE(){} ~QUEUE(){} void APPEND(const T val) { while(st2.empty()==false)...
分类:其他好文   时间:2015-09-01 01:45:14    阅读次数:173
C++控制台应用程序之贪吃蛇(改进版)
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 typedef struct{ int x, y; }Point; 10 11 char ...
分类:编程语言   时间:2015-09-01 01:34:41    阅读次数:196
STL_函数模板
#include #include using namespace std;#define MAX(T) \ T max_##T (T x, T y) {\ return x > y ? x : y; \ }//在预处理的时候生成下面3个具体 类型的函数MAX(int) // int max_in....
分类:其他好文   时间:2015-09-01 01:29:31    阅读次数:141
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!