码迷,mamicode.com
首页 >  
搜索关键字:struct stat    ( 35365个结果)
【HDOJ】1881 毕业bg
01背包。 1 #include 2 #include 3 #include 4 5 #define MAXN 1005 6 7 typedef struct { 8 int h, l, t; 9 } node_st;10 11 node_st nodes[35];12 13 in...
分类:其他好文   时间:2014-06-08 22:44:08    阅读次数:339
[LeetCode OJ] Max Points on a Line—Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
//定义二维平面上的点struct Point{ int x; int y; Point(int a=0, int b=0):x(a),y(b){}};bool operator==(const Point& left, const Point& right){ return...
分类:其他好文   时间:2014-06-08 22:26:17    阅读次数:357
Java——方法的重载
方法的重载就是在同一个类中可以同时存在多个同名的方法,只要这些方法的参数或类型不同。方法重载可以使两个方法的返回值不同,但只有返回值还不足以区分两个方法的重载,还需要通过参数的类型、个数、长度来设定。一个简单地例子:public class OverLoadTest { public stat...
分类:编程语言   时间:2014-06-08 22:03:09    阅读次数:524
Binary Tree Inorder Traversal
1. 递归解法 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cl...
分类:其他好文   时间:2014-06-08 16:51:59    阅读次数:199
设计模式C++实现——单例模式
模式定义:         单例模式确保一个类只有一个实例,并提供一个全局访问点。 模式结构: 单例模式编程实现及执行结果: #include using namespace std;         单例类 class Sigleton { public: static Sigleton* getInstance(); private: Sigleton(){} stat...
分类:编程语言   时间:2014-06-08 15:08:54    阅读次数:242
如何处理Java异常的两个例子?
下面有两个例子。一个是告诉我们调用方法也需要处理被调用者所抛出的异常;另一个是告诉我们父类可以被用来捕获或者处理异常。 1.调用方法必须处理被调用者所抛出的异常 下面是一个小小处理异常的程序。仅仅只是为了测试,如果在一个方法里抛出一个异常,不仅仅那个方法,而且调用该方法的所有方法必须声明或抛出该异常。 public class exceptionTest { private stat...
分类:编程语言   时间:2014-06-08 10:49:52    阅读次数:282
割点 桥 双连通分量模版
求割点 const int maxn = 1010; vector a[maxn], bcc[maxn]; int pre[maxn]; int low[maxn]; bool iscut[maxn]; int bccno[maxn]; int cnt[maxn]; int dfs_clock; int bcc_cnt; int n; struct Edge { int u, v; };...
分类:其他好文   时间:2014-06-08 05:54:36    阅读次数:270
Light OJ 1026 Critical Links 求桥
题目来源:Light OJ 1026 Critical Links 题意:输出桥 思路:模版 #include #include #include #include #include using namespace std; const int maxn = 10010; struct Edge { int u, v; Edge(){} Edge(int u, int v):...
分类:其他好文   时间:2014-06-08 04:07:05    阅读次数:235
Light OJ 1291 Real Life Traffic 双连通最少添边数
题目来源:Light OJ 1291 Real Life Traffic 题意:最少添加几条边 可以使全图边双连通 思路:缩点 重新构图 答案就是(叶子节点数+1)/ 2 #include #include #include #include #include using namespace std; const int maxn = 10010; struct Edge { i...
分类:其他好文   时间:2014-06-08 02:57:26    阅读次数:276
多项式的表示
1.多项式的系数存放在数组中 # include # include # define max(x,y) ((x)>(y)?(x):(y)) using namespace std; const int N=100; struct poly { int arr[N]; int mexp; }; void add(poly &a,poly &b,poly &c) { memset(c.ar...
分类:其他好文   时间:2014-06-08 02:17:57    阅读次数:264
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!