上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 99 下一页

2012年3月19日

public 继承

摘要: View Code #include <iostream>#include <string>#include <cstdlib>using namespace std;class student{ public: student( ) { name = "tang"; num = "104080219"; sex = "M"; } void display( ); void input( ); private: string name; string num; string sex;};class 阅读全文

posted @ 2012-03-19 15:25 more think, more gains 阅读(161) 评论(0) 推荐(0) 编辑

c++ 运算符重载

摘要: View Code /*运算符重载,类型转换函数,转换构造函数无参默认构造函数,带参初始化构造函数,*/#include <iostream.h>//#include <iostream>#include <cstdlib>//using namespace std;class Complex{ public: Complex( ) { real = 0; imag = 0; } //无参默认构造函数 //Complex(double r) { real = r; imag = 0;} 转换构造函数 Complex(double r, double i) { 阅读全文

posted @ 2012-03-19 14:41 more think, more gains 阅读(123) 评论(0) 推荐(0) 编辑

2012年3月13日

最短路复习

摘要: HDU 1874 1.dijkstra 算法View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<algorithm>using namespace std;const int inf = 0x7f7f7f7f;int mp[400][400];int visit[400];int dis[400];int S, T;void dij( int N ){ for( int i = 0; i < N; i++) { visit[i] = 0; dis[i 阅读全文

posted @ 2012-03-13 14:11 more think, more gains 阅读(138) 评论(0) 推荐(0) 编辑

2012年3月11日

并查集最小生成树复习

摘要: HDU 1856 more is better 简单并查集View Code #include <stdio.h>int set[100010], num[100010];int maxn = 1;int find( int x){ // return x == set[x] ? x : set[x] = find(set[x]); if( x != set[x] ) { set[x] = find(set[x]); } return set[x];}void merge( int x, int y){ int x1 = find( x ); int y1 = find( ... 阅读全文

posted @ 2012-03-11 11:17 more think, more gains 阅读(172) 评论(0) 推荐(0) 编辑

2012年3月8日

网络流算法之一

摘要: 1. Edmonds-karp 算法用广度优先搜索来实现对增广路径p的计算,即如果增广入径是残留网络中从(s到t的最短路径,就能改进FORD-FULKERSON的界,称Ford-Fulkerson方法的这种实现为Edmonds-karp算法,时间复杂度为O(VE^2);HDU 3549View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <deque>using namespace std;int cap[100][100];int a[100];in 阅读全文

posted @ 2012-03-08 23:24 more think, more gains 阅读(558) 评论(0) 推荐(0) 编辑

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 99 下一页

导航