摘要: #coding=gbk import os #operating system import sys #system import copy from pprint import pprint #perfect print from operator import attrgetter a = [1, 2, 3, 4, 5] b = [6, 7, 8, 9, 10] #python使用引用计数 c = a print c #[1, 2, 3, 4, 5] c[0] = -1 print c #[-1, 2, 3, 4, 5] print a #[-1, 2, 3, 4, 5] a[... 阅读全文
posted @ 2012-05-29 20:29 junfeng_feng 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 服务器:/* *run command: * g++ server.cpp -o server && ./server */ #ifndef SERVER #define SERVER #include<arpa/inet.h> #include<assert.h> #include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<errno.h> #include<assert.h> #include<string.h&g 阅读全文
posted @ 2012-05-29 20:04 junfeng_feng 阅读(561) 评论(0) 推荐(0) 编辑
摘要: -module(exam). -compile(export_all). %1杨辉三角 start(N) when is_integer(N) -> print(N,1,1). %C表示行数 %LC表示C对应的list print(N,1,_) -> io:format("~p~n",[[1]]), print(N,2,1); print(N,2,_) -> io:format("~p~n",[[1,1]]), print(N,3,[1,1]); %Lc_minus_1 表示C-1行的list print(N,... 阅读全文
posted @ 2012-05-29 20:01 junfeng_feng 阅读(395) 评论(0) 推荐(0) 编辑
摘要: //字符串同素:包含相同的char,以及char出现的次数#include <iostream> #include <stdio.h> #include <map> #include <assert.h> #include <string.h> #include "boost/smart_ptr.hpp" using namespace std;const int CHAR_NUMBER = 256;//答题的时候,好像写成255了 bool get(char* str,int* arr) { if( str == 阅读全文
posted @ 2012-05-29 16:54 junfeng_feng 阅读(167) 评论(0) 推荐(0) 编辑