分析:不需要一般象棋程序的“着法生成器”也可以求解more
```cpp
include
include
using namespace std;
typedef char Board[8][8];
typedef struct _Position {
int row;
int col;
} Position;继续阅读 »
什么是Check
Check是C语言的一个单元测试框架。它提供一个小巧的单元测试接口。测试案例运行在各自独立的地址空间,所以断言失败和代码错误造成的段错误或者其他的信号可以被捕捉到。另外,测试的结果显示也兼容以下这些格式:Subunit、TAP、XML和通用的日志格式。
Check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space继续阅读 »
2018.4.3 19:00 ~ 2018.4.3 21:00
求回文子字符串数量
```python
import sys
def check(s):
length=len(s)
for i in range(length):
if s[i]!=s[length-1-i]:
return 0
return 1
s=sys.stdin.readline().strip()
res=0
try:
for i in range(len(s)):
for j in range(i+1,len(s)+1):
if check(继续阅读 »
xmake provides some api, which can detect whether exist some library functions.
```lua
target("test")
-- checks some libc functions from the header files: wchar.h and stdlib.h
add_cfuncs("libc", nil, {"wchar.h", "stdlib.h"}, "wcscat",
继续阅读 »
Why
读ConcurrentHashMap的时候,我们遇到的一个很大的概念就是Segment(java8之后只有在调用writeObject方法的方法的时候才会用到segment),该类继承了ReentrantLock,用于实现分段锁(乐观锁)。处于心痒痒的目的,我也尝试写了个简陋版的分段锁。
How
该Demo实现的比较简单:根据key获取或者创建Lock(获取锁的时候使用double check),然后使用该锁来同步put或者read(ConcurrentHashMap的读操作使用的volatile,这里不深入)。不足之处还请指正~
What
java实现: github
more
```java
package 继续阅读 »
New features
Add automaticlly check libc interfaces
Support custom allocator
Add trace for allocator in the debug mode
Add static_pool module
Add stream interfaces for reading all data to string
Add adler32 hash algorithm
Add tb_memmem interface
Add regex module with pcre, pcre2 or posix regex
Changes
Optimize stre继续阅读 »
pipeR 0.4 is released! Check it out at the project page. In this new version, two things happen. First, %>>% handles everything. Second, the introduction of Pipe object.继续阅读 »
Python Stackoverflow 经典问题
What does the “yield” keyword do?
What is a metaclass in Python?
How do I check whether a file exists using Python?
Does Python have a ternary conditional operator?
Calling an external command in Python
What does if __name__ == “__main__”: do?
How to make a chain of function decorators in继续阅读 »