This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bisect | |
import itertools | |
import operator | |
class _BNode(object): | |
__slots__ = ["tree", "contents", "children"] | |
def __init__(self, tree, contents=None, children=None): | |
self.tree = tree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"testing" | |
"time" | |
) | |
func sum(n ...int) int { | |
var c int | |
for _, i := range n { | |
c += i | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Why so thin ? | |
// | |
// function - func | |
// semicolor no required | |
// struct new easy : o := Owner{id:1,name:"lcj"} | |
// define var so easy :o := Owner{id:1,name:"lcj"} | |
// if () ,() no required | |
// type cast with (type),.(int) etc | |
// go 的struct,传值,在函数内修改的,只是堆栈上的副本,改了是无法影响函数之外的。 | |
// 不容易发生深层嵌套。就像c# 那么,namespace / class /function ,至少三层。而go,member function 总是一层 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"time" | |
) | |
// 时间格式化字符串(奇葩的设置) | |
const TimeFormat = "2006-01-02 15:04:05" | |
const TimeFormat1 = "2006-01-02" | |
func TestXYZ(t *testing.T) { | |
r1,_:=time.Parse(TimeFormat1,"2014-04-11") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
#include <stdlib.h> | |
*/ | |
import "C" | |
import ("fmt") | |
func Random() int { | |
return int(C.random()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" ; "container/list" | |
"time" | |
"errors" | |
) | |
type rect struct { | |
width, height int | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ("fmt" | |
// "math" | |
) | |
const max =8 | |
func main(){ | |
q := Queen{sum:0} | |
q.put(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Code by Slyar | |
http://www.slyar.com/blog/eight-queen-c-program.html*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define max 8 | |
int queen[max], sum=0; /* max为棋盘最大坐标 */ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p id="demo">Click the button to decode a URI after encoding it.</p> | |
<button onclick="myFunction()">Try it</button> | |
<script> | |
function myFunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//外部可见的函数 "encodeURI", 内部实现为URIEncode,对应关系在最后一个函数内 | |
// Copyright 2006-2008 the V8 project authors. All rights reserved. | |
// ------------------------------------------------------------------- | |
// This file contains support for URI manipulations written in | |
// JavaScript. | |
// Lazily initialized. | |
var hexCharArray = 0; | |
var hexCharCodeArray = 0; |
OlderNewer