自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(188)
  • 问答 (3)
  • 收藏
  • 关注

原创 poj 1654 Area

You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step to the following

2015-08-16 18:10:57 456

转载 叉积与点积

计算几何是算法竞赛的一大块,而叉积是计算机和的基础。首先叉积是计算说向量之间的叉积,那么我们可以这样定义向量,以及向量的运算符重载。[cpp] view plaincopyprint?struct Point  {      double x,y;      Point(double x=0,double y=0):x(x

2015-08-16 18:06:15 760

转载 poj 1319 Pipe Fitters

A company manufactures pipes of uniform diameter. All pipes are stored in rectangular storage containers, but the containers come in several different sizes. Pipes are stored in rows within a containe

2015-08-16 17:27:28 521

转载 poj 1182

食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 53661 Accepted: 15733Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动

2015-08-16 16:54:50 370

原创 背包总结

关于背包问题的讲解,有篇DD牛写的《背包问题九讲》,凭我这水平怎么说也没有这篇文章说的清楚,直接看文章吧。我只把我认为的比较概括的东西写出来。看完背包九讲再来看这个会比较好,我这个只是对背包九讲的总结加上一点点自己的总结和一些经典题目。标注:下文n即为物品件数,c[i]表示第i件物品的耗费(体积),V为背包容量,a[i]表示第i件物品的价值 dp[]数组存放的即为最优解。一、01背包

2015-08-16 14:51:42 475

原创 CSU 1120 病毒

你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文件和备份日志文件在感染后可能会变得不一样。给出被感染的主日志和备份日志,求真实事件序列的最长可

2015-08-10 20:56:29 438

原创 CSU 1115 最短的名字

在一个奇怪的村子中,很多人的名字都很长,比如aaaaa, bbb and abababab。名字这么长,叫全名显然起来很不方便。所以村民之间一般只叫名字的前缀。比如叫'aaaaa'的时候可以只叫'aaa',因为没有第二个人名字的前三个字母是'aaa'。不过你不能叫'a',因为有两个人的名字都以'a'开头。村里的人都很聪明,他们总是用最短的称呼叫人。输入保证村里不会有一个人的名字是另外一个人名字

2015-08-10 20:55:33 426

原创 CSU 1113 Updating a Dictionary

In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given an old dictionary and a new dictionary, find out what wer

2015-08-10 20:54:18 601

原创 ZOJ 3212 K-Nice

This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this one.We say an element is

2015-08-10 20:41:37 372

原创 ZOJ 3211 Dream City

JAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There are n trees in the yard. Let's call them tree 1, tree 2 ...and tree n. At the first day, each tree i has ai coins on it (i=1

2015-08-10 20:40:11 414

原创 ZOJ 3203 Light Bulb

Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodious house,

2015-08-10 20:38:21 411

原创 UVA 232 Crossword Answers

http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=32396uva232题目弄不下来#include #include struct p{ int x,y;} ma[15][15];int main(){ int n,m,t=1,i,j,tt=0; int ansa[10

2015-08-10 20:33:21 396

原创 UVA 1587 Box

Ivan works at a factory that produces heavy machinery. He has a simple job -- he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangular

2015-08-10 20:27:45 547

原创 UVA 1225 Digit Counting

Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N(1 N  . After that, he counts the number of times e

2015-08-10 20:20:30 356

原创 UVA 227 Puzzle

A children's puzzle that was popular 30 years ago consisted of a 55 frame which contained 24 smallsquares of equal size. A unique letter of the alphabet was printed on each small square. Since there

2015-08-10 20:03:10 438

原创 CSU 1337 搞笑版费马大定理

费马大定理:当n>2时,不定方程an+bn=cn没有正整数解。比如a3+b3=c3没有正整数解。为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, c=79时43+93=793。输入两个整数x, y, 求满足xInput输入最多包含10组数据。每组数据包含两个整数x, y(18)。Output对于每组数

2015-08-10 19:55:45 494

原创 CSU 1334 好老师

我想当一个好老师,所以我决定记住所有学生的名字。可是不久以后我就放弃了,因为学生太多了,根本记不住。但是我不能让我的学生发现这一点,否则会很没面子。所以每次要叫学生的名字时,我会引用离他最近的,我认得的学生。比如有10个学生:A ? ? D ? ? ? H ? ?想叫每个学生时,具体的叫法是:位置叫法1A2

2015-08-10 19:54:08 460

原创 CSU 1328 近似回文词

输入一行文本,输出最长近似回文词连续子串。所谓近似回文词是指满足以下条件的字符串:1. S以字母开头,字母结尾2. a(S)和b(S)最多有2k个位置不同,其中a(S)是S删除所有非字母字符并且把所有字母转化成小写之后得到的串,b(S)是a(S)的逆序串。比如当k=1时,Race cat是一个近似回文词,因为a(S)=racecat和b(S)=tacecar只有2个位置不同。

2015-08-10 19:51:05 707

原创 CSU 1513 Kick the ball!

"A penalty shoot-out (officially kicks from the penalty mark) is a method of determining the winner of an association football (soccer) match that is drawn after the regulation playing time and any ap

2015-08-10 19:47:34 711

原创 CSU 1511 残缺的棋盘

Input输入包含不超过10000 组数据。每组数据包含6个整数r1, c1, r2, c2, r3, c3 (1Output对于每组数据,输出测试点编号和最少步数。Sample Input1 1 8 7 5 61 1 3 3 2 2Sample OutputCase 1: 7C

2015-08-10 19:46:04 721

原创 ZOJ 3204 Connect them

You have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computers i and j is the same as connec

2015-08-09 22:51:23 463

转载 搜索 剪枝

搜索算法的通用优化方法[DFS][搜索剪枝]在很多情况下,我们已经找到了一组比较好的解。但是计算机仍然会义无返顾地去搜索比它更“劣”的其他解,搜索到后也只能回溯。为了避免出现这种情况,我们需要灵活地去定制回溯搜索的边界。*例题 计算机网络连接要将n(n求:一种连接方式,使需要电缆的长度最短。分析这个题目用回溯搜索来解决。但是,由于回溯搜索的搜索量比较大,

2015-08-09 22:12:57 465

原创 CSU 1507 超大型LED显示屏

DescriptionInput输入包含不超过100组数据。每组数据第一行为"START hh:mm:ss",表示比赛开始时刻为hh:mm:ss。最后一行为"END hh:mm:ss",即比赛结束时刻。二者之间至少会有一个SCORE信息,格式为"SCORE hh:mm:ss team score",其中team要么是"home"(主场)要么是"gue

2015-08-06 17:20:38 486

原创 CSU 1505 酷酷的单词

输入一些仅由小写字母组成的单词。你的任务是统计有多少个单词是“酷”的,即每种字母出现的次数都不同。比如ada是酷的,因为a出现2次,d出现1次,而1和2不同。再比如,banana也是酷的,因为a出现3次,n出现2次,b出现1次。但是,bbacccd不是酷的,因为a和d出现的次数相同(均为1次)。Input输入包含不超过30组数据。每组数据第一行为单词个数n

2015-08-06 17:19:32 639

原创 ZOJ 2737 Occurrence

Given a string A which can be represented as A1A2..An (n is the length of A) and a string B which can be represented as B1B2..Bm (m is the length of B), you will need to find the occurrence of B from

2015-08-06 17:18:11 603

原创 ZOJ 2748 Free Kick

In a soccer game, a direct free kick is also awarded to the opposing team if a player commits any of the offences.A direct free kick in an immediate distance is a nightmare of the goalie. In order

2015-08-06 17:16:41 522

原创 ZOJ 3326 An Awful Problem

In order to encourage Hiqivenfin to study math, his mother gave him a sweet candy when the day of the month was a prime number. Hiqivenfin was happy with that. But several days later, his mother modif

2015-08-06 17:14:37 447

原创 FZU 1106 Sum of Factorials

John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics, meteorology, sci

2015-08-06 17:12:49 509

原创 UESTC 169 快快告诉我时间

你知道吗,小明的舅舅是有名的科学家!小明经常在电视上看到舅舅被一大群拿着黑色短棍子的人围着,妈妈说,那是记者们在采访舅舅。小明生日这天舅舅虽然没有来,可是却送来了一个很神秘的礼物。咦,一个哑铃状的装着红色沙子的玻璃管子固定在木头架子上,这是什么东西呢?妈妈说,这个东西叫“沙漏”,是很久很久以前人们用来算时间用的。可是妈妈却没有说人们是怎么用它来算时间的。于是小明开始了研究。小明发现沙漏

2015-08-06 17:11:41 560

原创 UESTC 170 三国

话说在三国时代,曹操曾亲率大军追打刘备,刘备势单力薄,只得向盟友孙权借兵,接下来,我将对这场战争作具体描述。战争发生在中国大陆上(一张二维平面),刘备的大本营在成都,坐标($0$,$0$),曹操的大军和孙权的援兵都驻扎在成都的周围,将用一个坐标点表示,不同地方驻扎的兵力有所不同,但所有人的行进速度都是单位$1$。战争一开始,曹操所有的部队同时向刘备进发,此时幸得诸葛亮神机妙算,知道曹操来了,于是就

2015-08-06 17:10:05 510

原创 SPOJ NWERC11E Please, go first

Please, go firstYou are currently on a skiing trip with a group of friends. In general, it is going well: you enjoy the skiing during the day and, of course, the après-skiing during the night. How

2015-08-06 17:08:44 717

原创 HDU 4229 Vive la Difference!

Take any four positive integers: a, b, c, d. Form four more, like this:|a-b| |b-c| |c-d| |d-a| That is, take the absolute value of the differences of a with b, b with c, c with d, and d with a

2015-08-06 17:02:21 396

原创 LightOJ 1051 Good or Bad

A string is called bad if it has 3 vowels in a row, or 5 consonants in a row, or both. A string is called good if it is not bad. You are given a string s, consisting of uppercase letters('A'-'Z') an

2015-08-06 17:01:09 458

原创 CSU 1032 OSU! Scoring System

OSU! is a rhythm game based on the gameplay of a variety of popular commercial rhythm games. The gameplay consists of only three elements: hit circles on the screen, dragging a ball across a fixed pat

2015-08-05 15:42:35 547

原创 CSU 1034 The Composition of Letters

Given a list of n letters (A1, A2, A3… An) and a word W. The letters and the word are in capitals. Each letter has a value which is its sequence in the alphabet. For example, ‘A’ has a value that equa

2015-08-05 15:39:00 458

原创 CSU 1030 素数槽

处于相邻的两个素数p和p + n之间的n - 1个连续的合数所组成的序列我们将其称为长度为n的素数槽。例如,‹24, 25, 26, 27, 28›是处于素数23和素数29之间的一个长度为6的素数槽。       你的任务就是写一个程序来计算包含整数k的素数槽的长度。如果k本身就是素数,那么认为包含k的素数槽的长度为0。Input第一行是一个数字n,表示需要测试

2015-08-05 15:35:02 625

原创 CSU 1029 Palindrome

A palindrome is a symmetrical string, that is, a string read the same from left to right as from right to left. You are asked to write a program which, given a string, determines whether it is a palin

2015-08-05 15:33:11 326

原创 POJ 1050 To the Max

Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of

2015-08-05 15:31:03 454

原创 POJ 2192 Zipper

Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must sta

2015-08-05 15:29:39 365

原创 ZOJ 2850 Beautiful Meadow

Tom's Meadow Tom has a meadow in his garden. He divides it into N * M squares. Initially all the squares were covered with grass. He mowed down the grass on some of the squares and thinks the mead

2015-08-05 15:28:00 596

空空如也

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

TA关注的人

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