- 博客(92)
- 资源 (7)
- 收藏
- 关注
原创 天堂里的游戏
天堂里的游戏多年后,每当Noder看到吉普赛人,就会想起那个遥远的下午。Noder躺在草地上漫无目的的张望,二楼的咖啡馆在日光下闪着亮,像是要进化成一颗巨大的咖啡豆。天气稍有些冷,但草还算暖和。不远的地方坐着一个吉普赛姑娘,手里拿着塔罗牌,带着耳机,边上是她的狗。狗看起来有点凶,姑娘却漂亮。Noder开始计算各种搭讪方式的成功概率,然而狗的存在……。奇怪的事情发生了,姑娘自己走了过来,把耳机戴在No
2015-06-06 22:00:36
949
原创 控制台彩色版“俄罗斯方块”
此程序的AI采用的是Pierre Dellacherie算法的改进方案,据说可以摆几十W个不死,不过我把一个好算法实现渣了,只能摆到1W左右,最多最多的一次摆到了6W
2014-06-23 21:39:07
6116
原创 PHP 中英文截取无乱码
在学习MySql 字符集时,解决了PHP中英文截取无乱码的问题。这个方法的核心在于判断取多少个字节上。<?php //PHP中英文截取无乱码header('Content_type=text/php;charset=UTF-8');$str = '浙江zju大学';//关键在于判断往后截多少个字节上,这是这个函数的核心//此函数是用客串来判断的,效率不高//位运算效果会更好/
2014-04-26 20:50:53
1763
原创 C# 接口初探
接口声明语法:public interface IDisposable{ void Disposable();}声明接口在语法上与声明抽象类完全相同,但不允许
2014-04-09 20:12:50
635
原创 浙大2012上机 PAT1034. Head of a Gang (30)
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t
2014-03-22 13:49:33
1754
原创 浙大2012上机 PAT 1031. Hello World for U (20)
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters must be pr
2014-03-22 10:49:12
713
原创 浙大2012上机 PAT 1032. Sharing (25)
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,
2014-03-22 10:09:44
833
原创 浙大2012上机 PAT 1033. To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga
2014-03-22 09:32:53
819
原创 浙大2013复试:PAT 1057. Stack (30)
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Po
2014-03-20 20:18:16
3092
原创 POJ 2299 Ultra-QuickSort(树状数组+离散化处理)
DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque
2014-03-20 18:49:09
586
原创 HDOJ 11166 敌兵布阵(树状数组)
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视
2014-03-20 15:38:46
755
原创 HDOJ 1556 Color the ball
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。 Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。 Sample Inpu
2014-03-20 15:02:15
521
原创 浙大2013复试:PAT 1056. Mice and Rice (25)
Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice
2014-03-19 21:41:55
2714
1
原创 浙大2013复试:PAT 1055 The World's Richest (25)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl
2014-03-19 20:56:06
1355
原创 PAT 1053. Path of Equal Weight (30)
Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R
2014-03-19 18:49:49
556
原创 PATA 1020 Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor
2014-03-19 15:20:39
634
原创 清华2006年复试上机题:二叉树遍历
题目描述:二叉树的前序、中序、后序遍历的定义:前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树;中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右子树;后序遍历:对任一子树,先遍历其左子树,然后遍历其右子树,最后访问根。给定一棵二叉树的前序遍历和中序遍历,求其后序遍历(提示:给定前序遍历与中序遍历能够唯一确定后序遍历)。输入:
2014-03-19 11:15:40
922
原创 中缀表达式转换为后缀表达式
在做计算器时,如果想要中缀表达式:A+B*(C-D)-E/F的值,不妨先转换为相应的后缀表达式为: ABCD-*+EF/-,再利用栈来计算,可能会方便很多。中缀表达式转换为后缀表达式的代码如下:#include #include #include using namespace std;int prior(char op){ if (op == '+' || op ==
2014-03-18 15:11:12
1372
原创 图论模板
Dijkstra+邻接表(HDU 2544 最短路)#include#include#include#include#include#include#include#include#include#includeusing namespace std ;#define pret(a,b) memset(a,b,sizeof(a))const int INF =
2014-03-16 22:49:53
526
原创 九度1449:确定比赛名次(拓扑排序)
题目描述:有N个比赛队(1输入:输入有若干组,每组中的第一行为二个数N(1输出:给出一个符合要求的排名。输出时队伍号之间有空格,最后一名后面没有空格。其他说明:符合条件的排名可能不是唯一的,此时要求输出时编号小的队伍在前;输入数据保证是正确的,即输入数据确保一定能有一个符合要求的排名。样例输入:4 31 22 34 3
2014-03-16 20:24:44
1202
原创 九度1448:Legal or Not
题目描述:ACM-DIY is a large QQ group where many excellent acmers get together. It is so harmonious that just like a big family. Every day,many "holy cows" like HH, hh, AC, ZT, lcc, BF, Qinz and so on
2014-03-16 19:57:29
616
原创 2014年天勤计算机考研复试上机练习赛(2):世界杯来了
题目描述2014年是世界杯年,小明作为一个资深球迷必然不会错过这场足球界的饕餮盛宴。但是由于比赛太多,而且并不是任何时间小明都能够看球赛,所以小明把他重点关注的那些球赛的转播时间表给你,希望你能够帮他合理安排一下,让他能够尽量多的看到完整的球赛。输入格式输入包含多组测试数据,每组输入的第一行是一个整数n(n接下来n行,每行输入两个整数si
2014-03-15 20:39:24
1651
原创 上海交大2009 日期差值
题目描述:有两个日期,求两个日期之间的天数,如果两个日期是连续的我们规定他们之间的天数为两天输入:有多组数据,每组数据有两行,分别表示两个日期,形式为YYYYMMDD输出:每组数据输出一行,即日期差值样例输入:2011041220110422样例输出:11这个题做了我一个晚上,不是不会做,说出来全是泪呀。。在
2014-03-10 21:41:37
490
原创 连续子数组的最大和
题目:输入一个整形数组,数组里有正数也有负数。数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和。求所有子数组的和的最大值。要求时间复杂度为O(n)。例如输入的数组为1, -2, 3, 10, -4, 7, 2, -5,和最大的子数组为3, 10, -4, 7, 2,因此输出为该子数组的和18。如果不考虑时间复杂度,我们可以枚举出所有子数组并求出他们的和。int M
2014-03-10 16:28:14
821
原创 2014名校复试机考模拟题 21376:朋友圈
题目链接:http://zju.acmclub.com/index.php?app=problem_title&id=1&problem_id=21376题目描述小明所在的学校有N个学生,形成M个俱乐部。每个俱乐部里的学生有着一定相似的兴趣爱好,形成一个朋友圈。一个学生可以同时属于若干个不同的俱乐部。根据“我的朋友的朋友也是我的朋友”这个推论可以得出,如果A和B是朋
2014-03-09 20:26:58
1113
原创 2014名校复试机考模拟题 21375:小明的约会
题目链接:http://zju.acmclub.com/index.php?app=problem_title&id=1&problem_id=21375题目描述小明和他的女朋友是两朵奇葩,总是愿意把简单问题搞得很复杂,这不小明刚接到女朋友发来的一条微信:“我们约会吧!3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm
2014-03-09 16:51:52
1113
原创 2014名校复试机考模拟题 21373:最爱回文串
题目描述土豪大学的高富帅实验室里有一个回文帝,名叫小明。小明每次看到一个字符串的时候总喜欢看看它是不是回文串,如果这个字符串不是回文串的话,他就会将这个字符串里的字符重新排列,看看能不能构成回文串。现在小明想让你写一个程序来帮助他实现上述过程。输入格式输入包含多组测试数据。每组输入包含一个字符串,长度不超过5,不包含空格等空白符。
2014-03-09 16:44:48
1052
原创 POJ 3255 Roadblocks
DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery alo
2014-03-09 10:01:15
930
原创 POJ 1789 Truck History
DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing ea
2014-03-08 15:53:34
608
原创 POJ 1258 Agri-Net
DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John or
2014-03-08 14:45:10
603
原创 PATA 1073. Scientific Notation (20)
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]"."[0-9]+E[+-][0-9]+ which means that the in
2014-03-08 13:20:55
1000
原创 PAT Basic Level 1021. 个位数统计 (15)
给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0i<=9, i=0,...,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。输入格式:每个输入包含1个测试用例,即一个不超过1000位的正整数N。输出格式:对N中每一种不同的个位数字,以D:
2014-03-08 10:37:52
1639
原创 PAT 1025. 反转链表 (25)
给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素不反转。输入格式:每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址、结点总个数正整数N(5)、以及正整数K(接下来有N行,每行格式为:Add
2014-03-08 10:21:45
6160
原创 PAT Basic Level 1024. 科学计数法 (20)
科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留。输入格式:每个输入包含1个测试用例,即一个以科学计
2014-03-07 20:41:42
1736
原创 PAT 1023. 组个最小数 (20)
给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数。
2014-03-07 18:09:56
2802
原创 PAT(Basic Level) 1022 D进制的A+B (20)
输入两个非负10进制整数A和B(30-1),输出A+B的D (1 输入格式:输入在一行中依次给出3个整数A、B和D。输出格式:输出A+B的D进制数。输入样例:123 456 8输出样例:1033注意:有一个case是0和0,如果不注意的话,这个测试点就很难过去。代码如下:#include#include#include#i
2014-03-07 16:41:39
1847
原创 PAT 1030 Travel Plan (30)
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b
2014-03-07 11:23:05
1278
原创 POJ 1502 MPI Maelstrom
DescriptionBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee'
2014-03-06 19:21:37
904
原创 POJ 2524 Ubiquitous Religions(并查集)
DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your
2014-03-05 21:14:32
664
Effective Java, 3rd Edition
2018-01-04
Python for Data Analysis, 2nd Edition.pdf
2017-11-16
Programming Scala- Scalability = Functional Programming + Objects, 2 edition
2015-06-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人