This file contains hidden or 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
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
//无法使用typeof,因为这是gcc的扩展 | |
//#define foreach(container,it) for(typeof((container).begin()) it=(container).begin();it!=(container).end();++it) | |
#define foreach(type,container,it) for(type::iterator it=(container).begin();it!=(container).end();++it) |
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
struct Pig | |
{ | |
Pig() | |
{ | |
call(); | |
} |
This file contains hidden or 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
#include "highgui.h" | |
#include "cv.h" | |
#include <stdio.h> | |
#define MAX_CORNERS 50 | |
int capture_data() | |
{ | |
CvCapture* capture; | |
IplImage* frame; |
This file contains hidden or 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
#! /usr/bin/env python | |
#coding=utf-8 | |
def mean(sorted_list): | |
if not sorted_list: | |
return ([],[]) | |
big=sorted_list[-1] | |
small=sorted_list[-2] | |
big_list,small_list=mean(sorted_list[:-2]) | |
big_list.append(small) |
This file contains hidden or 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
def double(n): | |
return n*2 | |
li=[5,'a',(2,'b')] | |
map(double,li) //返回[10,'aa',(2,'b',2,'b')] |
This file contains hidden or 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
def odd(n): | |
return n%2 | |
li=[1,2,3,5,9,10,256,-3] | |
filter(odd,li) //输出[1,3,5,9,-3] |
NewerOlder