自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

呃。。的专栏

呃。。。。。

  • 博客(10)
  • 资源 (2)
  • 收藏
  • 关注

原创 python 装饰器

1:没有参数的装饰器关于python的装饰器,写一点自己的理解。一个简单的没有参数的装饰器:运行结果如下:再来一个带参数的装饰器:执行结果如下:把装饰器分开写:执行结果:再来看看装饰器是怎么扩展的吧:

2013-01-12 18:22:37 438 1

原创 C++ 重载负号

#include using namespace std;class test {private: int x; int y;public: test(int xx = 0, int yy = 0) { x = xx; y = yy; }; test operator- (void) { this->x = -this->x; this->y = -thi

2013-01-09 22:57:47 4277 1

原创 python 斐波那契数列

用python写斐波那契数列当然大家都写的出来。当时如果用一行代码写呢。本来没有打算用一行代码写的。后来看到有用一行代码写阶乘的。reduce(lambda x, y:x*y, [i for i in range(1,n+1)])当然在这之前需要 from functools import  *好吧,如果你愿意,就算两行代码吧。既然能用一行代码写阶乘,也没有理由

2012-12-16 09:40:36 821

原创 简单的有限状态机

#include #define MAX_SIZE 8 int main(){ int matrix1[MAX_SIZE][MAX_SIZE] = {0}; int i = 0,state,count,line = 0,colum = 0 ; //初始化 i = 0, line = 0, colum = 0 enum { m_right, //向右移动 m_do

2012-12-13 09:51:45 334

原创 一个简单的spider

#!/usr/bin/env python3#coding=utf-8##data =2012-12-1#version=0.1.0#import osimport sysfrom urllib import parseurljoin = parse.urljoinurlsplit= parse.urlspliturlquote= parse.quote from b

2012-12-08 15:39:00 370

原创 洗牌程序

洗牌程序。用链表实现。#include #include #include typedef struct tcard { char number; char color; struct tcard * next;} card;card * init_card(void){ card * head = (card *) NULL; card * tail = (c

2012-11-25 16:25:20 262

原创 一个小程序

题目:输入一个日期。年月日。然后输入第二天的日期。。和星期几。。。本以为写个小程序很简单。。后来写了。才知道。。要考虑的东西真不少。。#!/usr/bin/env pythonimport reimport sysdef nextdate(year, month, day, flag): year = int(year) month = int(mon

2012-05-19 17:47:26 245

原创 ants crash problem

N ants are in a circular race. The length of the race is 1000 meters and ant number i is initially Vi meters far from starting point (point 0) of the race in clockwise order. All the ants walk with a

2012-05-16 20:55:11 428

原创 写一个函数 一句话判断传入的unsigned int 是不是2的整数词幂……

int fun(int x){return (x&1==1)?((x>1)?0:1):fun(x/2);}自己写的。。但是。。如果x为0会递归死掉。。。return x > 0 && (x&(x-1)) == 0;那啥写的。。。。呃。。刚开始写了一个判断是不是2的倍数的。。。。return ((x&1)==0)?1:0;

2012-05-09 21:06:33 431

原创 水仙花数字的通用算法(可计算21,34,甚至39位的水仙花数)

weishuo = input("Input :")print('*' * 50)number = [[x * i ** weishuo for x in range(weishuo+1)]for i in range(10)]matchlist = [0 for x in range(10)]s = [x for x in range(10)]bignumber = 0flag =

2012-04-14 19:11:13 1607

深入理解python3

介绍python3的文档。 python3入门教程

2012-12-13

C_standard_lib

c standard libary

2012-05-18

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除