inline内联函数可以实现在调用函数的地方拷贝代码副本,从而避免了函数调用跳转等存在的时间上耗时稍长的问题。
(inline 要写在函数 定义 与 声明 之前,如 inline double square(double);
inline double square(double x){return x*x;})
内联函数的使用前提:
1.代码段比较小
2.且函数调用频...
分类:
编程语言 时间:
2015-08-10 12:13:12
阅读次数:
183
【POJ 2531】Network Saboteur图的搜索 剪枝真是门学问。。剪好了快的可真不是一倍两倍刚开始搜的思路有问题 TLE了 后来枚举点暴力搜了一发 两百多ms由于查找时权值是不断增加的 所以直接找集合间最大权的话不方便设置return点看disscuss发现有一大牛 建了两个数组 通过所有边权-两集合内部边权(去重) 得到答案 dfs的时候找最小内部边权即可 当前状态权值>当前最小内部...
分类:
Web程序 时间:
2015-08-10 12:02:35
阅读次数:
114
路由配置文件定义:路由是指分析来自客户端请求的统一资源标识符(URI),根据设定的规则将请求分发至期待的处理逻辑(匹配请求地址),这一规则就是路由规则,而这一过程就是路由。
Route::get(‘/’, function() {
return view(‘index’);
});
我们访问 http://yourdoamin/ 会显示渲染后的视图文件 index 的内容。这...
分类:
Web程序 时间:
2015-08-10 10:42:30
阅读次数:
236
【107-Binary Tree Level Order Traversal II(二叉树层序遍历II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right,...
分类:
编程语言 时间:
2015-08-10 08:17:39
阅读次数:
169
原文出处第一种方法:function findNum($str=''){ $str=trim($str); if(empty($str)){return '';} $reg='/(\d{3}(\.\d+)?)/is';//匹配数字的正则表达式 preg_match_all($...
分类:
Web程序 时间:
2015-08-10 08:12:06
阅读次数:
168
题目:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the n...
分类:
其他好文 时间:
2015-08-10 07:04:35
阅读次数:
119
#include
using namespace std;
//古有求二进制数中1的个数,今有求二进制中0的个数。
int Grial(int x)
{
int count = 0;
while (x + 1)
{
count++;
x |= (x + 1);
}
return count;
}
int m...
分类:
编程语言 时间:
2015-08-10 02:02:04
阅读次数:
171
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:
其他好文 时间:
2015-08-10 01:48:40
阅读次数:
126
如果把身份证号码传到页面上,在前端页面获取年龄就需要用到JS脚本了:function GetAge(identityCard) { var len = (identityCard + "").length; if (len == 0) { return 0; } else { if ((len !=...
分类:
Web程序 时间:
2015-08-10 01:43:56
阅读次数:
143
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first
two lists.
递归解决很简单
/**
* Definition for singly-linked list.
* s...
分类:
其他好文 时间:
2015-08-10 00:30:50
阅读次数:
90