- 博客(28)
- 收藏
- 关注
原创 编写时钟程序
from turtle import *from datetime import *def skip(step): penup() fd(step) pendown()def mkhand(name,length): reset() skip(-length*0.1) begin_poly() fd(length*1
2017-05-01 22:36:42
911
原创 控制图形移动
通过键盘上的上下左右来控制画布中图形的移动from tkinter import *def main(): tk = Tk() canvas = Canvas(tk,width = 400,height = 400) canvas.pack() def moverectangle(event): if event.keysym
2017-04-30 23:50:13
742
原创 用鼠标点击画一个五边形
在窗口中点击5个点来画一个五边形from graphics import *def main(): win = GraphWin("Draw a polygon",300,300) win.setCoords(0.0,0.0,300.0,300.0) message = Text(Point(150,20),"Click on five points")
2017-04-30 23:46:57
1093
原创 输出文件平均绩点最高的学生
记录学生成绩文件students.txt。编写程序,通过读取文件找出平均绩点最高的学生,然后输出他的名字、学分和绩点。class student: def __init__(self,name,hours,qpoints): self.name = name self.hours = float(hours) sel
2017-04-30 18:13:49
1236
1
原创 统计一篇英语文章每个单词出现的频率
从文件中读取一篇英语文章,统计每个单词出现的频率,输出十个最长出现的单词及次数图像。import turtlecount = 10xscale = 30yscale = 6data = []words = []def replacepunctuations(line): for ch in line: if ch in "~@#$%^&*(
2017-04-30 13:53:12
3718
原创 从文件中读取数据动态路径绘制
文件第一列为移动距离,第二列0为向右左转为1向右转第三列为度数,后三列代表颜色import turtledef main(): turtle.title('数据驱动的动态路径绘制') turtle.setup(800,600,0,0) pen = turtle.Turtle() pen.color("red") pen.width(5)
2017-04-29 23:52:56
1176
原创 python语句实现文件合并
将有姓名和手机号的dian.txt和有姓名和邮箱的you.txt文件合并成一个有姓名手机号和邮箱的youdian.txt文件def main(): file1 = open("dian.txt","rb") file2 = open("you.txt","rb") file1.readline() file2.readline() line1
2017-04-29 23:46:28
999
原创 python绘制树和森林
from turtle import Turtledef tree(plist,l,a,f): if l > 5: lst = [] for p in plist: p.fd(l) q = p.clone() p.left(a) q.right(a)
2017-04-29 14:45:01
2421
原创 学生信息管理系统
定义一个包含学生信息(学号,姓名,成绩)的的顺序表和链表,使其具有如下功能:(1) 根据指定学生个数,逐个输入学生信息;(2) 逐个显示学生表中所有学生的相关信息;(3) 根据姓名进行查找,返回此学生的学号和成绩;(4) 根据指定的位置可返回相应的学生信息(学号,姓名,成绩);(5) 给定一个学生信息,插入到表中指定的位置;(6) 删除指定位置的学生记录;(
2016-09-21 14:26:34
1071
原创 LightOJ 1109 False Ordering
1109 - False Ordering PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBWe define b is a Divisor of a number a if a is divisible b
2016-08-25 18:01:43
251
原创 LightOJ 1225 Palindromic Numbers
1225 - Palindromic Numbers (II) PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBA palindromic number or numeral palindrome is
2016-08-25 17:57:54
314
原创 LightOJ 1182 Parity
1182 - Parity PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBGiven an integer n, first we represent it in binary. Then we cou
2016-08-25 17:54:36
317
原创 HDU 1599 find the mincost route
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1599Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过
2016-08-24 21:41:08
360
原创 LightOJ 1138 Trailing Zeroes
1138 - Trailing Zeroes (III) PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBYou task is to find minimal natural number N, so th
2016-08-24 10:12:24
361
原创 LightOJ 1045 Digits of Factorial
1045 - Digits of Factorial PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBFactorial of an integer is defined by the following f
2016-08-24 09:33:33
243
原创 LightOJ 1008 Fibsieve`s Fantabulous Birthday
1008 - Fibsieve`s Fantabulous Birthday PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBFibsieve had a fantabulous (yes, it's a
2016-08-23 21:29:32
284
原创 LightOJ 1294 Positive Negative Sign
1294 - Positive Negative Sign PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBGiven two integers: n and m and n is divisible by
2016-08-23 20:50:07
469
原创 LightOJ 1043 Triangle Partitioning
1043 - Triangle Partitioning PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBSee the picture below.You are given AB, AC
2016-08-23 20:40:27
350
原创 CodeForces 597A Divisibility
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 597ADescriptionFind the number of k-divisible numbers on the segmen
2016-08-23 20:32:14
322
原创 CodeForces 598A Tricky Sum
DescriptionIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum.For example, for n = 4 the sum is equal to - 1 -
2016-08-23 20:24:00
309
原创 CodeForces 660A Co-prime Array
Co-prime ArrayTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 660ADescriptionYou are given an array of n elements
2016-08-22 20:44:53
240
原创 CodeForces 554B Ohana Cleans Up
Ohana Cleans UpTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 554BDescriptionOhana Matsumae is trying to clean a
2016-08-22 20:40:40
375
原创 CF 685A Bear and Reverse Radewoosh
Bear and Reverse RadewooshTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionLimak and Radewoosh are going to compete against ea
2016-08-22 19:32:45
415
原创 CF 366a Dima and Guards
F - Dima and GuardsTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionNothing has changed since the last round. Dima and Inna st
2016-08-22 19:24:18
295
原创 南阳oj 1261 音痴又音痴的LT
描述LT最近一直在无限循环薛之谦的歌,简直都中毒了!可是呢…他的歌LT还是不会唱(其实不止他的歌LT不会唱,所有人的歌LT都不会唱…因为LT是标准的音痴)可是LT又很喜欢唱歌(所以LT不仅是音痴还是音痴)…没错,这对于LT的室友来说简直是噩梦… 现在呢,LT有N次操作,每次操作只会有两种可能: I a: 表示着LT使用唱歌软件唱歌得到的分数。 Q k: 表示着LT想知道自
2016-08-21 15:49:25
352
原创 zzuli oj 1917 连续子序列的价值和
Description晴天有非常严重的选择恐惧症,每次吃饭前他都在纠结到底吃什么。。今天又到了吃饭的时候了。重光:我给你一个包含n个不同整数的序列a,如果它所有连续子序列的价值和是素数咱们就吃米,不然就吃面。定义一个序列的价值为序列中所有元素的最小值。晴天:这不是分分钟给你算出来。嗯...十分钟过去了,晴天选择死亡。这个任务就交给你啦。算出所有连续子序列的价值和。
2016-08-19 21:53:20
526
原创 杭电 1166 敌兵布阵 (线段树)
DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报
2016-08-18 19:25:38
429
原创 zzuli oj 1918 晴天寻宝
Description晴天也来寻宝啦,有一个m层的宝塔,只能从第一层开始一层一层的往上走,每层都有一个门,你需要用钥匙来打开门才能继续走,现在晴天有n把钥匙,编号为0-n-1,然后他要开始寻宝了。没有特殊技能怎么好意思出来寻宝呢,他现在有两个天赋技能,他知道第i层的门可以用编号为a和b的钥匙打开(可能a等于b呦),然后他还可以在进入宝塔前把门的顺序任意调换一次,也就是说比如可以把m层原来的
2016-08-18 10:04:09
368
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人