# RePorridge

Nothing change but our heart

2016年3月13日

posted @ 2016-03-13 22:18 Porridge 阅读(155) | 评论 (0)编辑 收藏

2013年11月1日

Problem Description
Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same value, because then they could just split the collection in half. But unfortunately, some of the marbles are larger, or more beautiful than others. So, Marsha and Bill start by assigning a value, a natural number between one and six, to each marble. Now they want to divide the marbles so that each of them gets the same total value.
Unfortunately, they realize that it might be impossible to divide the marbles in this way (even if the total value of all marbles is even). For example, if there are one marble of value 1, one of value 3 and two of value 4, then they cannot be split into sets of equal value. So, they ask you to write a program that checks whether there is a fair partition of the marbles.

Input
Each line in the input describes one collection of marbles to be divided. The lines consist of six non-negative integers n1, n2, ..., n6, where ni is the number of marbles of value i. So, the example from above would be described by the input-line ``1 0 1 2 0 0''. The maximum total number of marbles will be 20000.

The last line of the input file will be ``0 0 0 0 0 0''; do not process this line.

Output
For each colletcion, output ``Collection #k:'', where k is the number of the test case, and then either ``Can be divided.'' or ``Can't be divided.''.

Output a blank line after each test case.

Sample Input
1 0 1 2 0 0
1 0 0 0 1 1
0 0 0 0 0 0

Sample Output
Collection #1:
Can't be divided.

Collection #2:
Can be divided.

Dividing
posted @ 2013-11-01 12:44 Porridge 阅读(305) | 评论 (0)编辑 收藏

2013年10月6日

--------------------------------------------------------------------------------------------
2016-5-11修改代码 for循环不能用<=越界访问
Onprime
posted @ 2013-10-06 21:43 Porridge 阅读(448) | 评论 (0)编辑 收藏

2013年9月23日

tarp given score refund only trap work earn course pepper part
******
resco nfudre aptr sett oresuc

score
refund
part trap trap
:(

course

resortletter.cpp
posted @ 2013-09-23 21:29 Porridge 阅读(338) | 评论 (0)编辑 收藏

2013年9月8日

Problem B
Back to High School Physics
Input: standard input
Output: standard output

A particle has initial velocity and constant acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time?

Input
The input will contain two integers in each line. Each line makes one set of input. These two integers denote the value of v (-100 <= v <= 100) and t(0<=t<= 200) ( t means at the time the particle gains that velocity)

Output
For each line of input print a single integer in one line denoting the displacement in double of that time.

Sample Input
0 0
5 12

Sample Output
0
120

physics.cpp
posted @ 2013-09-08 21:15 Porridge 阅读(355) | 评论 (0)编辑 收藏
ox of Bricks

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8910 Accepted Submission(s): 3032

Problem Description
Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. “Look, I've built a wall!”, he tells his older sister Alice. “Nah, you should make all stacks the same height. Then you would have a real wall.”, she retorts. After a little consideration, Bob sees that she is right. So he sets out to rearrange the bricks, one by one, such that all stacks are the same height afterwards. But since Bob is lazy he wants to do this with the minimum number of bricks moved. Can you help?

Input
The input consists of several data sets. Each set begins with a line containing the number n of stacks Bob has built. The next line contains n numbers, the heights hi of the n stacks. You may assume 1≤n≤50 and 1≤hi≤100.

The total number of bricks will be divisible by the number of stacks. Thus, it is always possible to rearrange the bricks such that all stacks have the same height.

The input is terminated by a set starting with n = 0. This set should not be processed.

Output
For each set, print the minimum number of bricks that have to be moved in order to make all the stacks the same height.
Output a blank line between each set.

Sample Input
6
5 2 4 1 7 5
0

Sample Output
5

BoxOfBricks.cpp
posted @ 2013-09-08 21:04 Porridge 阅读(429) | 评论 (0)编辑 收藏

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11284 Accepted Submission(s): 6168

Problem Description

Input

Output

Sample Input

Sample Output
13.4

sprintf的功能是将变量写到字符串中去 用法 sprintf(char*,/*输出格式如*/"%d",/*要输出的量如*/2)这样输出的结果就是"2\0";

HDU2090exp.cpp

HDU2090.cpp
posted @ 2013-09-08 20:56 Porridge 阅读(943) | 评论 (0)编辑 收藏

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13604 Accepted Submission(s): 4362

Problem Description

62315 73418 88914

Input

Output

Sample Input
1 100
0 0

Sample Output
80

HDU2089.cpp
posted @ 2013-09-08 20:46 Porridge 阅读(440) | 评论 (0)编辑 收藏
A Knight's Journey
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 26210 Accepted: 8950
Description

Background
The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey
around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he is living on. Our knight lives on a chessboard that has a smaller area than a regular 8 * 8 board, but it is still rectangular. Can you help this adventurous knight to make travel plans?

Problem
Find a path such that the knight visits every square once. The knight can start and end on any square of the board.
Input

The input begins with a positive integer n in the first line. The following lines contain n test cases. Each test case consists of a single line with two positive integers p and q, such that 1 <= p * q <= 26. This represents a p * q chessboard, where p describes how many different square numbers 1, . . . , p exist, q describes how many different square letters exist. These are the first q letters of the Latin alphabet: A, . . .
Output

The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print a single line containing the lexicographically first path that visits all squares of the chessboard with knight moves followed by an empty line. The path should be given on a single line by concatenating the names of the visited squares. Each square name consists of a capital letter followed by a number.
If no such path exist, you should output impossible on a single line.
Sample Input

3
1 1
2 3
4 3
Sample Output

Scenario #1:
A1

Scenario #2:
impossible

Scenario #3:
A1B3C1A2B4C2A3B1C3A4B2C4
Source

TUD Programming Contest 2005, Darmstadt, Germany

POJ2488.cpp
posted @ 2013-09-08 20:31 Porridge 阅读(355) | 评论 (0)编辑 收藏

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 22457 Accepted Submission(s): 5433

Problem Description
lily的好朋友xiaoou333最近很空，他想了一件没有什么意义的事情，就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。

Input

Output

Sample Input
you are my friend
#

Sample Output
4

HDU2072.cpp
posted @ 2013-09-08 19:59 Porridge 阅读(639) | 评论 (0)编辑 收藏

### 导航

 < 2023年2月 >
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

• 随笔 - 23
• 文章 - 1
• 评论 - 0
• 引用 - 0

•