- 博客(20)
- 资源 (2)
- 收藏
- 关注
原创 Pygame学习0x00
Pygame安装Pygame介绍: Pygame如字面意思,是方便python开发游戏的python包,对于pygame,安装方法与其他的包的安装方法一致。Python包安装方法: 使用pip进行安装: pip是常用的python包安装工具,在linux平台中,直接使用即可,在windows下,需要对环境变量进行配置,在Python的安装目录下的Scripts文件夹中我们可以发现pip.exe文
2016-08-02 23:11:12
395
原创 快速排序算法简述
快速排序在算法具有重要的地位,每一位程序都应该了解,并且能够熟练使用,以下最简单递归实现方法(C++)#include <iostream> using namespace std;void quickSort(int num[],int left,int right) { int i,j,tmp; if(left<right) { i=left;
2015-10-09 23:27:20
1568
原创 盒子游戏(The Seventh Hunan Collegiate Programming Contest)
盒子游戏 有两个相同的盒子,其中一个装了n个球,另一个装了一个球。Alice和Bob发明了一个游戏,规则如下:Alice和Bob轮流操作,Alice先操作。每次操作时,游戏者先看看哪个盒子里的球的数目比较少,然后清空这个盒子(盒子里的球直接扔掉),然后把另一个盒子里的球拿一些到这个盒子中,使得两个盒子都至少有一个球。如果一个游戏者无法进行操作,他(她)就输了。下图是一个典型的游戏: 面对两个各
2013-08-25 17:34:41
811
原创 一二三(The Seventh Hunan Collegiate Programming Contest)
一二三你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗? 输入 第一行为单词的个数(不超过10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。 输出 对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方
2013-08-25 17:26:28
1420
原创 Robberies(HDOJ2955)
Robberies Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7620 Accepted Submission(s): 2859 Problem Description The aspiring Roy
2013-07-19 17:20:01
558
原创 Bone Collector(HDOJ2602)
Bone Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 20880 Accepted Submission(s): 8345 Problem Description Many years
2013-07-18 15:50:45
487
转载 最佳子矩阵的算法
1、最大子段和问题 问题定义:对于给定序列a1,a2,a3……an,寻找它的某个连续子段,使得其和最大。如( -2,11,-4,13,-5,-2 )最大子段是{ 11,-4,13 }其和为20。 (1)枚举法求解 枚举法思路如下: 以a[0]开始: {a[0]}, {a[0],a[1]},{a[0],a[1],a[2]}……{a[0]
2013-07-16 17:23:12
1087
原创 F~Help Johnny(13.7.12)
F. Help Johnny Description Poor Johnny is so busy this term. His tutor threw lots of hard problems to him and demanded him to accomplish those problems in a month. What a wicked tutor! After cursin
2013-07-13 21:20:59
557
原创 B~A simple problem(13.7.12)
B. A simple problem Description Dreamone has a lovely cat. The cat can comfort you if you are very dejected, she can also play with you if you are very bored. So Dreamone loves her very much. Of co
2013-07-13 21:16:39
533
原创 I~Matrix(13.7.11)
Problem I. Matrix Input le: stdin Output le: stdout Time limit: 2 seconds To ecient calculate the multiplication of a sparse matrix is very useful in industrial led. Let's consider this problem:
2013-07-13 21:13:00
1348
原创 H~Little Sheep and a paper(13.7.11)
Problem H. Little Sheep and a paper Input le: stdin Output le: stdout Time limit: 2 seconds One day, Little Sheep gets an AK(all kill) in a contest, so he is very boring, then he just plays with a
2013-07-13 21:06:26
694
转载 快速幂
所谓的快速幂,实际上是快速幂取模的缩写,简单的说,就是快速的求一个幂式的模(余)。在程序设计过程中,经常要去求一些大数对于某个数的余数(素数测试),为了得到更快、计算范围更大的算法,产生了快速幂取模算法。 我们先从简单的例子入手:求a ^ b % c = ? 算法1.首先直接地来设计这个算法: [cpp] view plaincopyprint
2013-07-11 09:55:49
575
原创 E~The mell hall(13.7.9)
Problem E. The mell hall Input le: stdin Output le: stdout Time limit: 2 seconds In HUST,there are always many students go to the mell hall at the same time as soon as the bell rings. Students ha
2013-07-10 20:08:46
580
原创 A.Eming(13.7.7)
A.Eming Eming is a contest hold by WHUACM trainingteam. The aim is to select new members of the team. Usually, the first problem is a very simpleproblem such as “a+b problem”. But this
2013-07-10 19:58:15
544
原创 E.Function(13.7.8)
E.Function Define a functionf(n)=(f(n-1)+1)/f(n-2). You already got f(1) and f(2). Now, give you a numberm, please find the value of f(m). Input There are several test cases. Each
2013-07-10 19:53:03
1891
原创 D.Brackets(13.7.8)
D.Brackets This year MK is 5 years old. So he decides to learnsome arithmetic. But he was confused by how towrite the brackets. He has already known that the brackets should match whenwriting the
2013-07-10 19:42:32
596
原创 B.Arithmetic Progression(13.7.7)
B.Arithmetic Progression “Inmathematics, an arithmetic progression (AP) or arithmetic sequence is asequence of numbers such that the difference between the consecutive terms isconstant. For instanc
2013-07-10 19:22:27
632
原创 蜗牛!快爬!(小学算术问题)
Problem Description 很久以前有一只蚂蚁,某天在路上走着走着,突然看见了一只蜗牛,爬的很慢。心想自己虽然比它小,可是跑得比它快,于是蚂蚁想跟蜗牛进行一次马拉松比赛,想证明它的实力。蚂蚁跟蜗牛商量后决定在星期六下午进行马拉松比赛。 Theday is coming….比赛跑道为一条直线,Unlucky!!跑道上有很多坑。注意哦,坑!蜗牛想知道它掉下坑底后,爬上来需要多少时间,你
2013-07-10 10:47:29
1137
原创 A even and odd(13.7.6)
#include using namespace std; int main(){ long long n,k; while(cin>>n>>k){ if(n%2!=0){ if(k<=((n+1)/2)){ cout<<(2*k-1)<<endl;} else{cout<<2*(k-(n+1)/2)<<endl;}} else{ if(k<=n/2){
2013-07-06 19:52:41
621
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅