自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Win_Man的专栏

心有猛虎,细嗅蔷薇

  • 博客(57)
  • 收藏
  • 关注

原创 1054 The Dominant Color

Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the d

2015-11-21 16:21:11 268

原创 1051 Pop Sequence

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of t

2015-11-21 15:54:20 1044

原创 1040 Longest Symmetric String

Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest symmetric sub-string is "s PAT&TAP s", hence you must

2015-11-21 10:11:45 390

原创 1050 String Subtraction

Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However,

2015-11-21 10:10:13 328

原创 1035 Password

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L

2015-11-19 20:14:30 453

原创 1025 PAT Ranking

Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w

2015-11-19 14:35:04 425

原创 1058 A+B in Hogwarts

If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Si

2015-11-16 22:36:33 313

原创 1037 Magic Coupon

The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product b

2015-11-16 22:34:59 605 1

原创 1036 Boys vs Girls

This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains o

2015-11-16 22:33:25 393

原创 1029 Median

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The

2015-11-16 22:31:31 305

原创 1013 Battle Over City

It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee

2015-11-16 22:25:43 419

原创 Scrapy爬虫的尝试

今天尝试了一下使用Scrapy框架来写Python的爬虫。是根据Scrapy的官方文档中的简单的样例修改的。尝试了一下分析http://zj.qq.com网页,找出网站中的所有的图片。首先定义了一个Item类class ImgItem(scrapy.Item): src = scrapy.Field()之后是Spider的类import scrapyfrom tutorial.it

2015-11-15 18:43:35 478

转载 windows安装配置Scrapy环境

转载文章这篇文章中描述的很详细,步骤全,很容易操作。但是有一些注意点就是下载的一些文件可能是.whl文件。在windows环境下安装.whl需要通过pip来操作。具体操作:1.在cmd中运行pip操作,如果提示不是系统命令,就想python安装目录下的Scripits文件的路径添加到path环境变量中去。2.切换到.whl文件所在的目录下,在命令行中输入 pip install x

2015-11-13 23:36:58 851

原创 Java MD5加密算法的实现

看了MD5算法详细介绍这篇博客之后,想着实现一下MD5加密算法。本来想完整的实现加密算法的,但是后来发现Java中的MessageDigest包中已经打包好了MD5的加密算法,使用起来十分方便,于是就直接使用这个实现了。如果有时间还是可以完整的步骤实现一下试试的。import java.security.MessageDigest;import java.security.NoSuchAlgor

2015-11-13 22:25:29 461

原创 python 重命名当前文件夹下所有文件

#coding:utf-8import Imageimport osfs = [a for a in os.listdir('.') if os.path.isfile(a) and os.path.splitext(a)[1] != '.py']count = 0for f in fs: os.rename(f,'%d%s' %(count,os.path.splitext(f)[

2015-11-11 21:32:53 683

原创 1065 A+B and C(64bit)

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.Input Specification:The first line of the input gives the positive number of test cases, T (Output

2015-11-10 14:26:21 429

原创 1028 List Sorting

Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N

2015-11-10 14:25:16 342

原创 1027 Colors in Mars

People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 dig

2015-11-09 22:18:52 270

原创 1031 Hello World for u

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

2015-11-09 22:18:01 311

原创 1100 Mars Numbers

People on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars.The numbers 1 to 12 on Earch is called "jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec" on Ma

2015-11-06 21:05:15 427

原创 1093 count PAT's

The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.No

2015-11-06 21:04:16 311

原创 1083 List Grades

Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades

2015-11-06 21:03:24 344

原创 1012 the Best Rank

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng

2015-11-06 21:02:27 323

原创 1006 Sign in and Sign out

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you

2015-11-06 21:01:23 531

原创 1005 Spell it right

Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.

2015-11-06 21:00:27 347

原创 1045 快速排序

著名的快速排序算法里有一个经典的划分过程:我们通常采用某种方法取一个元素作为主元,通过交换,把比主元小的元素放到它的左边,比主元大的元素放到它的右边。 给定划分后的N个互不相同的正整数的排列,请问有多少个元素可能是划分前选取的主元?例如给定N = 5, 排列是1、3、2、4、5。则:1的左边没有元素,右边的元素都比它大,所以它可能是主元;尽管3的左边元素都比它小,但

2015-11-05 08:26:08 393

原创 1044 火星数字

火星人是以13进制计数的:地球人的0被火星人称为tret。地球人数字1到12的火星文分别为:jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec。火星人将进位以后的12个高位数字分别称为:tam, hel, maa, huh, tou, kes, hei, elo, syy, lok, mer, jou。例

2015-11-05 08:25:12 679

原创 1043 输出PATest

给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“PATestPATest....”这样的顺序输出,并忽略其它字符。当然,六种字符的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按PATest的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字符串。输出格式:在

2015-11-05 08:24:17 587

原创 1042 字符统计

请编写程序,找出一段给定文字中出现最频繁的那个英文字母。输入格式:输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。输出格式:在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统计时不区分大小写,输出小写字母。

2015-11-05 08:23:18 595

原创 1041 考试座位号

每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。输入格式:输入第一行给出一个正整数N(考生信息之后,给出一个正整数

2015-11-05 08:22:13 658

原创 1040 有几个PAT

字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位(P),第4位(A),第6位(T);第二个PAT是第3位(P),第4位(A),第6位(T)。现给定字符串,问一共可以形成多少个PAT?输入格式:输入只有一行,包含一个字符串,长度不超过105,只包含P、A、T三种字母。输出格式:在一行中输出给定字符串中包含多少个PAT。由于结果可能比较大,

2015-11-04 22:35:07 442

原创 1039 到底买不买

小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。为方便起见,我们用[0-9]、[a-z]、[A-Z]范围内的字符来表示颜色。例如在图1中,第3串是小红想做的珠串;那么第1串可以买,因为包含了全部她想要的珠

2015-11-04 22:34:19 568 1

原创 1038 统计同成绩学生

本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。输入格式:输入在第1行给出不超过105的正整数N,即学生总人数。随后1行给出N名学生的百分制整数成绩,中间以空格分隔。最后1行给出要查询的分数个数K(不超过N的正整数),随后是K个分数,中间以空格分隔。输出格式:在一行中按查询顺序给出得分等于指定分数的学生人数,中间以空格分隔,但行末不得有多余空格。输

2015-11-04 22:33:32 520

原创 1037 在霍格沃茨找零钱

如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱P和他实付的钱A,你的任务是写一个程序来计算他应该被找的零钱。输入格式:输入在1行中分别给出P和A,格式为“Galleon.Sickle.Knut”,其间用1个空格分隔。

2015-11-04 22:32:51 470

原创 1036 跟奥巴马一起编程

美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长N(3输出格式:输出由给定字符C画出的正方形。但是注意到行间距比列间距大,所以为了让结果看上去更像正方形

2015-11-04 22:31:57 687

原创 1033 旧键盘打字

旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样?输入格式:输入在2行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过105个字符的串。可用的字符包括字母[a-z, A-Z]、数字0-9、以及下划线“_”(代表空格)、“,”、“.”、“-”、“+”(代

2015-11-04 22:30:29 393

原创 1032 挖掘技术哪家强

为了用事实说明挖掘机技术到底哪家强,PAT组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。输入格式:输入在第1行给出不超过105的正整数N,即参赛人数。随后N行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从1开始连续编号)、及其比赛成绩(百分制),中间以空格分隔。输出格式:在一行中给出总得分最高的学校的编号、及其总分,中间以空格

2015-11-04 22:29:44 457

原创 1031 查验身份证

一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X 9 8 7 6 5 4 3 2

2015-11-04 22:28:58 1509

原创 1030 完美数列

给定一个正整数数列,和正整数p,设这个数列中的最大值是M,最小值是m,如果M 现在给定参数p和一些正整数,请你从中选择尽可能多的数构成一个完美数列。输入格式:输入第一行给出两个正整数N和p,其中N(5)是输入的正整数的个数,p(9)是给定的参数。第二行给出N个正整数,每个数不超过109。输出格式:在一行中输出最多可以选择多少个数可以用它们组成一个完美数列。

2015-11-04 22:28:13 348

原创 1029 旧键盘

旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。输入格式:输入在2行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过80个字符的串,由字母A-Z(包括大、小写)、数字0-9、以及下划线“_”(代表空格)组成。题目保证2个字符串均非空。输出格式:按照发现顺序,

2015-11-04 22:27:27 605

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除