Really fun regex one.import ren = int(input())txt = ''for _ in range(n): str = input() txt = txt + strdict = {}all = re.findall(']*>', txt)for i...
分类:
Web程序 时间:
2015-06-03 06:09:44
阅读次数:
165
引子:关于闭包什么是闭包呢? 从定义上来看,所有的函数都可以是闭包。当一个函数在调用时,引用了不是自己作用域内定义的变量(通常称其为自由变量),则形成了闭包;闭包是代码块和创建该代码块的上下文中数据的结合。例子: function mytest( ){ var test=10; return fun...
分类:
Web程序 时间:
2015-06-02 12:43:27
阅读次数:
138
Go语言中os包提供了一些环境变量的操作封装。包括:设置环境变量:Setenv获取环境变量:Getenv删除指定的环境变量:Unsetenv获取所有环境变量:Environ清除所有环境变量:Clearenv请看示例代码:package main import "os"import "fmt" fun...
分类:
其他好文 时间:
2015-06-01 22:24:06
阅读次数:
130
DescripeMike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n?×?m grid, there's exactly o...
分类:
其他好文 时间:
2015-06-01 20:26:42
阅读次数:
127
在一个纯粹的原型模式中,我们会摒弃类,转而专注于对象,基于原型的继承相比基于类的继承的概念上更为简单if( typeof Object.beget !== 'function'){ Object.beget = function(o) { var F = fun...
分类:
编程语言 时间:
2015-05-31 20:06:46
阅读次数:
116
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int n;
int a[100015];
int b[100015];
int fun(int m){
for(int i = 0;i < n;i++){
if(i ...
分类:
其他好文 时间:
2015-05-30 21:17:29
阅读次数:
200
Read CodeKarianne BergWE PROGRAMMERS ARE WEiRD CREATURES. We love writing code. But when it comes to reading it, we usually shy away. After all, writing code is so much more fun, and reading code is ha...
分类:
其他好文 时间:
2015-05-30 09:20:21
阅读次数:
161
工作告一段落,闲来无事,写了一个在nodejs实现“半阻塞”的控制程序。一直以来,nodejs以单线程非阻塞,高并发的特性而闻名。搞这个“半阻塞”是东西,有什么用呢?场景一:现在的web应用可有都是一个这样的结构:http服务(node) > 接口(业务逻辑) > 数据库很多时候,瓶颈一般出现在业务...
分类:
其他好文 时间:
2015-05-29 17:44:27
阅读次数:
149
方程都给出来了,直接敲代码就好了。
#include
#include
#include
using namespace std;
int dp[25][25][25];
int dfs(int a,int b,int c)
{
if(a<=0 || b<=0 || c20 || b>20 || c>20)...
分类:
其他好文 时间:
2015-05-28 10:59:29
阅读次数:
135
1 #include 2 #include 3 #define M 20 + 5 4 using namespace std; 5 int a[M]; 6 int fun(long long int m) //fun函数: 7 { 8 memset...
分类:
其他好文 时间:
2015-05-27 22:26:31
阅读次数:
155