泡沫

博客园 首页 联系 订阅 管理

2013年6月25日

摘要: 题目:http://acm.timus.ru/problem.aspx?space=1&num=1748题意:求n范围内约数个数最多的那个数。Roughly speaking, for a number to be highly composite it has to have prime factors as small as possible, but not too many of the same. If we decompose a number n in prime factors like this:where are prime, and the exponents a 阅读全文
posted @ 2013-06-25 19:22 木-天空 阅读(485) 评论(0) 推荐(0) 编辑

2013年6月23日

摘要: ural 1091 题目链接: http://acm.timus.ru/problem.aspx?space=1&num=1091题意是从1到n的集合里选出k个数,使得这些数满足gcd大于1解法:因子有2的数: 2,4,6,8,10,12,14.。。因子有3的数:3,6,9,12,15,18,21.。。因子有5的数:5,10,15,18,21,24.。。可以看出这里求出的集合时会有重复的,得去从。可惜没有学过容斥原理。不过解决这题还是没问题的。50以内的素因子有:2, 3, 5, 7, 11, 13, 17, 19, 23只有这些素因子才可能产生集合元素大于2的集合排除重复度为2的集合 阅读全文
posted @ 2013-06-23 22:21 木-天空 阅读(385) 评论(0) 推荐(0) 编辑

2013年5月20日

摘要: 集合是一个由唯一元素组成的非排序集合体。“非排序”是指元素不以任何特定顺序存储。用于存储集合的数据结构是散列表(hash_table),这也很好的印证里集合的定于。下面来学set有哪些操作方法。创建集合#创建两个空集合set_a = set()set_b = set()add 往集合里添加一个元素 for i in xrange(10): set_a.add(i)print list(set_a)#[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]for i in xrange(5, 16): set_b.add(i)print list(set_b)#[5, 6, 7... 阅读全文
posted @ 2013-05-20 22:08 木-天空 阅读(743) 评论(0) 推荐(1) 编辑

2013年5月19日

摘要: 编写一个类,具有栈和队列的功能。实现以下4个方法:shit() 返回并删除列表中第一个元素unshit() 在列表的头部‘压入’一个新的元素push() 在列表尾部增加一个元素pop() 返回并删除最后一个元素outAllData() 输出所有的数据class stackAndQueue(object): data = [] def isEmpty(self): return len(self.data)==0 def shift(self): if stackAndQueue.isEmpty(self): print 'th... 阅读全文
posted @ 2013-05-19 21:41 木-天空 阅读(522) 评论(0) 推荐(0) 编辑

摘要: python性能鸡汤之一 http://bbs.python123.com/forum.php?mod=viewthread&tid=42&extra=page%3D1&ordertype=2python性能鸡汤之二 http://www.python123.com/thread-43-1-1.htmlpython itertools 模块 http://www.cnblogs.com/cython/articles/2169009.htmlpython线程基础 http://tieba.baidu.com/p/1072881148学习pygame http://cs. 阅读全文
posted @ 2013-05-19 11:30 木-天空 阅读(391) 评论(0) 推荐(0) 编辑

2013年5月18日

摘要: 题目链接: http://www.codeforces.com/problemset/problem/285/DPermutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or the length 阅读全文
posted @ 2013-05-18 16:05 木-天空 阅读(689) 评论(0) 推荐(0) 编辑

摘要: 题目链接: www.codeforces.com/problemset/problem/300/CVitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if the sum of its digits is a 阅读全文
posted @ 2013-05-18 11:29 木-天空 阅读(400) 评论(0) 推荐(0) 编辑

2013年5月17日

摘要: 题目链接: http://acm.timus.ru/problem.aspx?space=1&num=1133problem description:is an infinite sequence of integers that satisfies to Fibonacci condition Fi+2=Fi+1+Fi for any integer i.Write a program, which calculates the value of Fn for the given values of Fi and Fj.InputThe input contains five int 阅读全文
posted @ 2013-05-17 18:52 木-天空 阅读(470) 评论(0) 推荐(0) 编辑

2013年5月10日

摘要: 在以下几篇博文里详细介绍了堆和栈的区别:http://blog.chinaunix.net/uid-26868581-id-3328648.htmlhttp://www.cppblog.com/oosky/archive/2006/01/21/2958.html这两篇博文都写的很经典,经典的让人无颜在写关于堆栈的事了。sizeof之详解以及sizeof与strlen的区别:http://blog.chinaunix.net/uid-26868581-id-3328170.html继承class A{}; class B{}; class C : public A, public B{}; cl 阅读全文
posted @ 2013-05-10 17:03 木-天空 阅读(218) 评论(0) 推荐(0) 编辑

2013年5月7日

该文被密码保护。 阅读全文
posted @ 2013-05-07 21:25 木-天空 阅读(31) 评论(0) 推荐(0) 编辑