如果你已经把基础看完,可以尝试一下看看以下例子了,如果不会做也不要紧,你要尝试手动把所有的代码都敲一边.别嫌麻烦,因为都是从麻烦到简单的. 实例1: 题目:有1.2.3.4个数字,能组成多少个相互不同且无重复的三位数?都是多少? #!/usr/bin/env python# --*--coding:utf-8 --*--'''可填在百位.十位.个位的数字都是1.2.3.4.组成所有的排列后再去 掉不满足条件的排列.'''for i in range(1,5): for j in rang
练习11: 题目: 古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 分析: 兔子的规律为数列1,1,2,3,5,8,13,21.... 程序: f1 = 1 f2 = 1 for i in range(1, 22): print('%d %d' % (f1, f2)) if (i % 3) == 0: print() f1 = f1 + f2 f2 = f1 + f2 输出结果: 1 1 2 3 5
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3007 解决:1638 题目描述: Find a longest common subsequence of two strings. 输入: First and second line of each input case contain two strings of lowercase character a…z. There are no spaces before, inside or after the strings. Le
温习一遍简单的sql语法,把自己掌握还不够的地方,做了些笔记.... 1 去重复关键词,distinct select distinct sname from student; 2 限制结果top的用法 select top 5 id from student 获取前五条记录 可以利用top来写sql分页语句 3 排序order by select * from student order by id,name desc; 默认是升序 asc,若是降序要在列名后标明desc order by语句