15暑假培训
文章平均质量分 65
whppmy
博客搬到 bugnull.com
展开
-
整数划分
描述整数划分是一个经典的问题。请写一个程序,完成以下要求。 输入每组输入是两个整数n和k。(1 输出对于输入的 n,k;第一行: 将n划分成若干正整数之和的划分数。第二行: 将n划分成k个正整数之和的划分数。第三行: 将n划分成最大数不超过k的划分数。第四行: 将n划分成若干个 奇正整数之和的划分数。第五行: 将n划分成若干不同整数之和的转载 2015-07-20 16:41:38 · 423 阅读 · 0 评论 -
马的走法
在一个4X5的棋盘上,马的起始位置坐标(纵、横)位置由键盘输入,求马能返回初始位置的所有不同走法的总数(马走过的位置不能重复,马走“日”字)。输入输入文件第一行为测试用例的个数N,接下来N行,每行两个正整数x,y(1,表示马的位置坐标.输出每个测试用例的输出占一行,输出马能返回初始位置的所有不同走法的总数,如果没有,则输出“ERROR”(不包含双引号)。原创 2015-07-16 16:26:16 · 1013 阅读 · 0 评论 -
悼念512汶川大地震遇难同胞——老人是真饿了
时间:2008年5月16日(震后第4天)地点:汶川县牛脑寨人物:羌族老奶奶【转载整理】牛脑寨是一个全村600多人的羌族寨子,震后几天,这里依然能常常听到隆隆的声音,那是对面山上石头不断滑落的声音。在完成整个突击队的抢修移动基站的任务后,我提着相机开始记录这里的受创情况。突然,我的视线里出现一个羌族老人,这让我无比的震惊,要知道,那是一个极陡的坡,这个佝偻着腰的老人是怎么艰难地爬原创 2015-07-14 09:32:00 · 484 阅读 · 0 评论 -
ZOJ 3883 Scan Code
Edward is writing an editor. After he wrote the function to get input from his special keyboard, he found that what he got is scan code, instead of ASCII code. He is very busy, so he gives you the eas原创 2015-09-05 16:52:53 · 584 阅读 · 0 评论 -
HDU 4414 Finding crosses
The Nazca Lines are a series of ancient geoglyphs located in the Nazca Desert in southern Peru. They were designated as a UNESCO World Heritage Site in 1994. The high, arid plateau stretches more than原创 2015-09-05 17:24:05 · 490 阅读 · 0 评论 -
ZOJ 2403 Stacking Cylinders
Cylinders (e.g. oil drums) (of radius 1 foot) are stacked in a rectangular bin. Each cylinder on an upper row rests on two cylinders in the row below. The cylinders in the bottom row rest on the floor原创 2015-09-05 16:39:49 · 401 阅读 · 0 评论 -
POJ 3191 The Moronic Cowmpouter
Inexperienced in the digital arts, the cows tried to build a calculating engine (yes, it's a cowmpouter) using binary numbers (base 2) but instead built one based on base negative 2! They were quite p原创 2015-09-05 16:49:51 · 503 阅读 · 0 评论 -
URAL 1933 Guns for Battle!
Will: Load the guns. Annamaria: With what? Will: Anything. Everything. Gibbs: Anything we have left. Load the guns! Case shot and langrage. Nails and crushed glass.“Black Pearl” always h原创 2015-09-05 17:27:55 · 465 阅读 · 0 评论 -
URAL 1939 First Seal
Jack: Everyone stay calm! We're taking over the ship.Will: Aye! Avast! Officer: This ship cannot be crewed by two men. You'll never make it out of the bay.Jack: Son... I'm Captain Jack Sparr转载 2015-09-05 17:42:31 · 519 阅读 · 0 评论 -
URAL 1931 Mixing Chemicals
Gibbs: Next! First Pirate: My wife ran off with my dog and I'm drunk for a month. Gibbs: Perfect. Next! Second Pirate: Me have one arm and a bum leg. Gibbs: It's the crow's nest for you. Next!原创 2015-09-05 18:05:42 · 446 阅读 · 0 评论 -
ZOJ 3890 Wumpus
One day Leon finds a very classic game called Wumpus.The game is as follow.Once an agent fell into a cave. The legend said that in this cave lived a kind of monster called Wumpus, and there were hor原创 2015-09-05 17:21:29 · 440 阅读 · 0 评论 -
ZOJ 3861 Valid Pattern Lock
Pattern lock security is generally used in Android handsets instead of a password. The pattern lock can be set by joining points on a 3 × 3 matrix in a chosen order. The points of the matrix are regis原创 2015-09-05 18:21:00 · 383 阅读 · 0 评论 -
NBUT 1223 Friends number
Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing… (The story in “the snow queen”原创 2015-09-05 18:18:13 · 409 阅读 · 0 评论 -
ZOJ 2412 Farm Irrigation
Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has a different type of原创 2015-09-05 16:46:29 · 476 阅读 · 0 评论 -
NBUT 1218 You are my brother
Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Little B is his elder, younger or brother.原创 2015-09-05 18:08:33 · 540 阅读 · 0 评论 -
NBUT 1220 SPY
The National Intelligence Council of X Nation receives a piece of credible information that Nation Y will send spies to steal Nation X’sconfidential paper. So the commander ofThe National Intellig原创 2015-09-05 18:13:26 · 618 阅读 · 0 评论 -
ZOJ 3867 Earthstone: Easy Version
Earthstone is a famous online card game created by Lizard Entertainment. It is a collectible card game that revolves around turn-based matches between two opponents. Players start the game with a subs原创 2015-09-05 18:23:53 · 434 阅读 · 0 评论 -
ZOJ 3703 Happy Programming Contest
In Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the contest, the team will get a lovely balloon with unique color f原创 2015-08-19 15:25:15 · 422 阅读 · 0 评论 -
ZOJ 3704 I am Nexus Master!
NexusHD.org is a popular PT (Private Tracker) site in Zhejiang University aiming to provide high quality stuff. In order to encourage users to unload more stuff, the administrators make the following原创 2015-08-19 15:28:18 · 575 阅读 · 0 评论 -
HDU 4722 Good Numbers
If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number. You are required to count the number of good numbers in the range from A to B,原创 2015-08-17 11:17:24 · 419 阅读 · 0 评论 -
ZOJ 2965 Accurately Say "CocaCola"!
In a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 o原创 2015-09-06 15:22:41 · 499 阅读 · 0 评论 -
ZOJ 3210 A Stack or A Queue?
Do you know stack and queue? They're both important data structures. A stack is a "first in last out" (FILO) data structure and a queue is a "first in first out" (FIFO) one.Here comes the problem:原创 2015-09-06 17:48:48 · 516 阅读 · 0 评论 -
HDU 1021 Fibonacci Again
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).原创 2015-07-14 09:12:50 · 401 阅读 · 0 评论 -
HDU 1548 A strange lift
Total Submission(s) : 11 Accepted Submission(s) : 3Problem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every fl转载 2015-07-14 09:54:52 · 323 阅读 · 0 评论 -
HDU 1015 Safecracker
=== Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and h原创 2015-07-14 09:46:14 · 396 阅读 · 0 评论 -
HDU 1010 Tempter of the Bone
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone转载 2015-07-14 09:44:44 · 357 阅读 · 0 评论 -
ZOJ 3872 Beauty of Array
Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the array. Now Edward wants to know the summation of the beauty of all contiguous原创 2015-09-06 12:38:57 · 404 阅读 · 0 评论 -
HDU 4710 Balls Rearrangement
Bob has N balls and A boxes. He numbers the balls from 0 to N-1, and numbers the boxes from 0 to A-1. To find the balls easily, he puts the ball numbered x into the box numbered a if x = a mod A.S原创 2015-08-19 15:02:41 · 361 阅读 · 0 评论 -
ZOJ 3708 Density of Power Network
The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In real world, the原创 2015-09-06 13:24:57 · 473 阅读 · 0 评论 -
ZOJ 3710 Friends
Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less thank friends in common, they will become friends in several days. Cu原创 2015-09-06 13:27:18 · 396 阅读 · 0 评论 -
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 · 398 阅读 · 0 评论 -
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 · 358 阅读 · 0 评论 -
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 · 527 阅读 · 0 评论 -
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 · 471 阅读 · 0 评论 -
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 · 705 阅读 · 0 评论 -
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 · 434 阅读 · 0 评论 -
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 · 347 阅读 · 0 评论 -
HDU 4528 小明系列故事――捉迷藏
小明的妈妈生了三个孩子,老大叫大明, 老二叫二明, 老三..., 老三自然就叫小明了。 一天,小明的妈妈带小明兄弟三人去公园玩耍,公园里面树木很多,有很多地方可以藏身, 于是他们决定玩捉迷藏。经过几轮的猜拳后,第一轮是小明来找其他两个人,游戏规则很简单: 只要小明可以在规定的时间内找到他们就算小明获胜,并且被发现的两个人猜拳决定谁在下一轮负责找人;如果在规定的时间内只找到一个人,那转载 2015-08-05 15:05:06 · 585 阅读 · 0 评论 -
HDU 4497 GCD and LCM
Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and lcm(x, y, z) = L?Note, gcd(x, y, z) means the greatest common转载 2015-08-05 14:42:26 · 318 阅读 · 0 评论 -
HDU 1049 Climbing Worm
An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches原创 2015-07-14 09:35:08 · 365 阅读 · 0 评论