16
Univerisity of Michigan ACM ICPC Qualifier 2012 October 7, 2012 Problem A Circles on a Screen Problem B Crossing Words Problem C Ancient Messages Problem D Don’t Be Afraid of the Function! Problem E Not a Composite Grid Problem F Kashi Sequences Problem G Defense of the Kingdom Problem H Reversible Primes Problem I Double Dealing Problem J Trash Removal Input is always from standard in and output to standard out (even if the problem description says otherwise). For all problems, assume multiple test cases in the input (even if the problem descriptions says one test case per input). Java: Please name classes: A, B, C, . . . , I, J. 1

Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

Univerisity of Michigan ACM ICPC Qualifier 2012

October 7, 2012

Problem A Circles on a Screen

Problem B Crossing Words

Problem C Ancient Messages

Problem D Don’t Be Afraid of the Function!

Problem E Not a Composite Grid

Problem F Kashi Sequences

Problem G Defense of the Kingdom

Problem H Reversible Primes

Problem I Double Dealing

Problem J Trash Removal

• Input is always from standard in and output to standard out (even if theproblem description says otherwise).

• For all problems, assume multiple test cases in the input (even if the problemdescriptions says one test case per input).

• Java:

– Please name classes: A, B, C, . . . , I, J.

1

Page 2: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem A. Circles on a Screen

Yesterday Andrew wrote a program that draws n white circles on a black screen. The screen ismonochrome and it has a resolution w × h pixels. Pixels are numbered from upper left corner (0, 0)to bottom right one (w − 1, h− 1).

A circle with the center at pixel (xc, yc) and the radius r consists of the pixels with coordinates (x, y)such that

√(xc − x)2 + (yc − y)2 ≤ r. If the circle does not fit on the screen, it is truncated. If some

pixel belongs to two or more circles, it is white.

The resulting picture was very nice, so Andrew decided to copy it to his wall. He has white wallpaperand he can only draw some parts of wall into black. Now he wants to know the amount of paint he needs.He copies the picture exactly pixel-to-pixel, so you should write a program that calculates the number ofblack pixels left on a screen after drawing n circles.

Input

The input contains multiple test cases separated by blank lines. Each test case begins with three integers:w, h, and n (1 ≤ w, h ≤ 20 000; 1 ≤ n ≤ 100). Each of the following n lines contains descriptions of thecircle. In i + 1-th line there are three integers: xi, yi, ri (0 ≤ xi < w; 0 ≤ yi < h; 0 ≤ ri ≤ 40 000).They denote a circle with the center at pixel (xi, yi) and radius ri. A last test case is followed by a linecontaining three zeros.

Output

You should output exactly one number per test case — the number of black pixels left on the screen.

Example

Input Output

5 3 2

1 1 1

3 1 1

12 9 2

3 3 2

7 5 4

0 0 0

6

51

Note: The picture corresponds to the second example.

Problem C from ACM ICPC 2009-2010, NEERC, Northern Subregional Contest

Page 1 of 15

Page 3: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem B. Crossing Words

Peter Pall is solving a crossword puzzle. He usually gets his puzzles from the auspicious Aggravatingly-Complicated Media group, which designs puzzles for all kinds of media. In this case the puzzles designedto be solved on a Plexiglas platform by using indelible sharpie markers. Obviously the sharpie markscannot be erased, ever, so Pall is particularly careful about writing down his answers into the squares ofthe puzzle. Each puzzle has a list of words and word placeholders. To solve a puzzle, each word needsto be placed into its appropriate location. Inability to erase the words makes the puzzles aggravatinglydifficult to solve. Since Pall has heard that you have a computer and poses a body of knowledge referredto as Computer Science, he wants you to write a program for him to solve the puzzles. Reluctantly, youagree. However, to not give away all the answers to the puzzle, you decide to let Pall choose a few words,placement of which he is particularly uncertain, and have your program will display placement hints forthose words only.

For example the unsolved puzzle may look like the puzzle below on the left.

If the words are: broker, key, omnibus,monkeys, kitty, simple, ubuntu, busy, book, then the solved puzzlewill look like the one above on the right. If Pall gives you three words he’d like your hints on, such as“broker”, “simple”, and “kitty”, your program will output the locations of those words with the wordsthemselves to get Pall started up on the puzzle.

Input

Each test case will start with integer numbers r and c, signifying rows and columns to follow. The nextr rows will consist of c characters each, giving you the state of an unsolved puzzle, where a ‘.’ (a dot)signifies a non-letter space of the puzzle where no letter can reside, and ‘*’ (a star) a place for a letter.The next line after will contain a number for the number of words needed to fill the puzzle completely,followed by n pairs or words, where each pair is a puzzle word between 2 and 20 characters inclusivelyin lower case, followed by its direction in the puzzle, specified as DOWN or ACROSS in capital letters.There will be a space between each word and direction and a space between each word-direction pair.

The next line after will contain the number h, followed by h hint words in lower case separated by aspace. These are the words, placement of which in the puzzle Pall wants to know. These hint words willget Pall started on the puzzle. This data completes a test case.

The last test case will start with a line containing numbers 0 0 to signify the end of input and thus itshould not be processed.

Output

For each test case, print out “Case k:” on the line by itself, replacing k with the appropriate test casenumber, starting from one. Then, for each hint word, list the hint word placements row and columnseparated by a space, followed by the hint word, in lower case, separated by a space. Print out a total

Page 2 of 15

Page 4: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

of h such lines, one line for each hint word. Order these lines by in the alphabetical order of hint words.For each test case, after the last hint line, output a blank line to separate the test cases. Do not outputany blank lines after the last test case.

Note : Assume that any given puzzle has exactly one solution.

Example

Input Output

11 11

.....******

...*....*..

...*******.

...*..*..*.

...*..*..*.

..******.*.

...*..*..*.

.****....*.

.*.........

.*.........

.*.........

9 busy ACROSS broker ACROSS book DOWN

key DOWN kitty DOWN monkeys

ACROSS omnibus DOWN simple DOWN ubuntu

ACROSS

3 broker simple kitty

3 3

***

*.*

***

4 cat ACROSS tom DOWN dim ACROSS cad

DOWN

2 cat tom

0 0

Case 1:

0 5 broker

2 6 kitty

2 9 simple

Case 2:

0 0 cat

0 2 tom

Page 3 of 15

Page 5: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem C. Ancient Messages

In order to understand early civilizations, archaeologists often study texts written in ancient languages.One such language, used in Egypt more than 3000 years ago, is based on characters called hieroglyphs.Figure C.1 shows six hieroglyphs and their names. In this problem, you will write a program to recognizethese six characters.

Figure C. 1: Six hieroglyphs

Input

The input consists of several test cases, each of which describes an image containing one or more hi-eroglyphs chosen from among those shown in Figure C.1. The image is given in the form of a seriesof horizontal scan lines consisting of black pixels (represented by 1) and white pixels (represented by0). In the input data, each scan line is encoded in hexadecimal notation. For example, the sequence ofeight pixels 10011100 (one black pixel, followed by two white pixels, and so on) would be represented inhexadecimal notation as 9c. Only digits and lowercase letters a through f are used in the hexadecimalencoding. The first line of each test case contains two integers, H and W . H (0 < H ≤ 200) is thenumber of scan lines in the image. W (0 < W ≤ 50) is the number of hexadecimal characters in eachline. The next H lines contain the hexadecimal characters of the image, working from top to bottom.Input images conform to the following rules:

• The image contains only hieroglyphs shown in Figure C.1.

• Each image contains at least one valid hieroglyph.

• Each black pixel in the image is part of a valid hieroglyph.

• Each hieroglyph consists of a connected set of black pixels and each black pixel has at least oneother black pixel on its top, bottom, left, or right side.

• The hieroglyphs do not touch and no hieroglyph is inside another hieroglyph.

• Two black pixels that touch diagonally will always have a common touching black pixel.

• The hieroglyphs may be distorted but each has a shape that is topologically equivalent to one ofthe symbols in Figure C.1 1.

The last test case is followed by a line containing two zeros.

1Two figures are topologically equivalent if each can be transformed into the other by stretching without tearing

Page 4 of 15

Page 6: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Output

For each test case, display its case number followed by a string containing one character for each hieroglyphrecognized in the image, using the following code:

Ankh: A

Wedjat: J

Djed: D

Scarab: S

Was: W

Akhet: K

In each output string, print the codes in alphabetic order. Follow the format of the sample output. Thesample input contains descriptions of test cases shown in Figures C.2 and C.3. Due to space constraintsnot all of the sample input can be shown on this page.

Figure C. 2: AKW Figure C. 3: AAAAA

Example

Input Output

100 25

0000000000000000000000000

0000000000000000000000000

...(50 lines omitted)...

00001fe0000000000007c0000

00003fe0000000000007c0000

...(44 lines omitted)...

0000000000000000000000000

0000000000000000000000000

150 38

00000000000000000000000000000000000000

00000000000000000000000000000000000000

...(75 lines omitted)...

0000000003fffffffffffffffff00000000000

0000000003fffffffffffffffff00000000000

...(69 lines omitted)...

00000000000000000000000000000000000000

00000000000000000000000000000000000000

0 0

Case 1: AKW

Case 2: AAAAA

ICPC 2011 World Finals Problem C: Ancient Messages

Page 5 of 15

Page 7: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem D. Dont Be Afraid of the Function!

Student Anatolij Anton Antonovich is afraid of the function. That evil professor Adnreev Andrej An-dreevich is at it again! He gave his students an impossible assignment. He gave them . . . “The Function”.Many stories exist at the school about “The Function”. Students have cheated, failed exams, and brokeup with their girlfriends, all because of “The Function”. Rumors say some students even died. . . a littlebit inside.

Now, for the first time, The Function can be seen in day broadlight:

y =( x

20

)5 + 2

( x

20

)4 − 52

( x

20

)3+ 3

( x

20

)2+ 524

( x

20

)− 329

I know this is hard, but be brave and try to not look away. It will get easier with time.

The assignment is as such: given a monotonic range [xlow, xhigh] and a target value of y, find x withinthe range, such that f(x) = y

By monotonic range, the professor, of course, means that the functions first derivative in this range doesnot change sign.

Input

Each line of input will list three numbers, separated by spaces. These numbers will be xlow, xhigh, and y,each of which fits in the IEEEs double value range. Input termination will be signified by three single-digitzeroes, separated by spaces. This last line containing zeroes is not to be processed.

Output

For each line of input, output a single number on a line by itself, trimmed to four decimal places. Thisnumber must satisfy the constraints given in the problem. f(x) will be considered to be equal to y if|y − f(x)| ≤ 1e-11. If per any chance, professor was so evil as to give an interval, where no value of xwill give the desired target value of y, you are to output “Professor, there is no Function...”. Bad thingshappen to students, when there is no Function . . . but dont let that phase you.

Example

Input Output

-36.1 43.1 3.1

-10 10 -100

-10 10 100

0 0 0

13.1740

8.8884

Professor, there is no Function...

Page 6 of 15

Page 8: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Page 7 of 15

Page 9: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem E. Not a Composite Grid

Curiously Strong Engineers consortium (CSE) is in the process of developing new grid-based gamesto compete with Sudoku. Matt “This Cool” Wolfenschnitzel, lead designer of CSE and head of theExtensively Employed Creative Synergy department (EECS) is a creator of the game that is the bestthings since Portal.

Matt This Cool has a reputation of doing really cool things. As your first task, Matt will give you thesize of the grid and a number between 1 and 100, which he puts in the top left corner of the grid. Usingnumbers 1 through 100, your task is to fill the rest of the grid according to the following rules: eachnumber in the grid must be unique; each consecutive pair of numbers both vertically and horizontallymust sum to a non-composite number; and the sum of all the numbers in the grid must be as small aspossible.

Note that this way there are many grids possible for any particular grid size. Matt “This Cool” wantsyou to pick the one that’s first lexicographically. This means that if there are two grids satisfying therules, pick the one that has the least first square (1st row 1st column). If there is a tie, pick one that hasthe least second square (1st row 2nd column), and so on. When the first row is over, and there is still atie, use the second row, and then the third one, and so on until and including the last row.

Matt guarantees that grids with sizes over 4 by 4 will either have an optimal solution, or none at all. Byoptimal solution, Matt means that only numbers 1 through g ∗ g can be used, where g is the size of thegrid.

Input

Input will consist of multiple test cases. Each test case consists of an integer number g, (1 ≤ g ≤ 10),indicating the size of g by g grid, followed by an integer number n, (1 ≤ n ≤ 100) that will go in the topleft corner of the grid to get you started. Fill in the rest of the grid according to the rules above.

Output

For each test case, output a line “Matt, here is puzzle #i:”, where i is the number of the puzzle,starting with 1, followed by the print out of the grid. Each grid consists of g rows and g columns ofnumbers. Space-justify each number according with the max number in the grid. If the max numberhas N digits, space-pad the first column to N places and the remaining column to N + 1 places. Therewill be no spaces after the last number in each row. For visual clarity, separate each pair of consecutiveprint-outs by a single blank line. Do not leave any extra blank lines after the last print-out. See sampleoutput for an example. If there are no grids possible, output “Yo, Matt! That puzzle #i, it was

not cool!” on a line by itself, where i is the puzzle counter. Because ya know . . .Matt is a really coolguy, and giving you impossible grids . . . it’s just not like him at all.

Page 8 of 15

Page 10: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Example

Input Output

6 1

3 1

5 2

10 23

0 0

Matt, here is puzzle #1:

1 2 3 4 7 6

10 21 16 13 24 5

19 22 25 18 23 14

12 31 36 35 8 15

29 30 17 26 33 28

32 11 20 27 34 9

Matt, here is puzzle #2:

1 2 5

4 3 8

7 10 9

Yo, Matt! That puzzle #3, it was not cool!

Matt, here is puzzle #4:

23 6 1 2 3 4 7 10 9 8

14 5 12 11 20 27 16 13 28 15

17 24 19 18 41 26 21 40 31 22

30 29 42 25 48 35 32 39 58 45

37 60 47 36 53 44 57 50 51 38

34 49 54 43 84 65 74 33 46 63

55 52 85 64 73 66 83 68 81 86

96 97 94 87 76 91 90 89 92 71

67 82 69 62 75 88 61 78 59 80

100 99 98 95 56 93 70 79 72 77

Page 9 of 15

Page 11: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem F. Kashi Sequences

Dr. Kashi is fond of torturing his students. For example, he gives you a positive integer n. Find thetotal number of distinct permutations of all Kashi sequences that sum to n. A Kashi sequence containsonly numbers of the form 2 + 3k, where k is a natural number.

Input

Each line will contain an integer n, between 1 and 100. Zero signifies end of the input.

Output

Output the total number of distinct permutations of all Kashi sequences for the given input number,mod 1000.

Example

Input Output

7

14

15

0

2

12

16

Note:

7 can be represented as 2 + 5 and 5 + 214 can be represented as 2 + 2 + 2 + 2 + 2 + 2 + 22 + 2 + 2 + 82 + 2 + 8 + 22 + 8 + 2 + 28 + 2 + 2 + 22 + 2 + 5 + 52 + 5 + 2 + 52 + 5 + 5 + 25 + 2 + 2 + 55 + 2 + 5 + 25 + 5 + 2 + 214

Page 10 of 15

Page 12: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem G. Defense of a Kingdom

Theodore implements a new strategy game “Defense of a Kingdom”. On each level player defends theKingdom that is represented by a rectangular grid of cells. The player builds crossbow towers in somecells of the grid. The tower defends all the cells in the same row and the same column. No two towersshare a row or a column.

The penalty of the position is a number of cells in the largest undefended rectangle. For example, theposition shown on the picture has penalty 12.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 x

12

34

56

78

y

Help Theodore write a program that calculates the penalty of the given position.

Input

The input contains multiple test cases separated by a blank line. The first line of each test case containsthree integer numbers: w —width of the grid, h — height of the grid and n — number of crossbow towers(1 ≤ w, h ≤ 40 000; 0 ≤ n ≤ min(w, h)).

Each of the following n lines contain two integer numbers xi and yi — the coordinates of the cell occupiedby a tower (1 ≤ xi ≤ w; 1 ≤ yi ≤ h).

Input terminates with a line with three zeros.

Output

For each test case output a single integer number — the number of cells in the largest rectangle that isnot defended by the towers.

Example

Input Output

15 8 3

3 8

11 2

8 6

0 0 0

12

Problem D from ACM ICPC 2010-2011, NEERC, Northern Subregional Contest

Page 11 of 15

Page 13: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem H. Reversible Primes

Your friend, Honorable Sir Filthy Richard Moneybags III, enjoys two things in life - playing the lotteryand using prime numbers for fun and profit. He profits from his interests by playing the lottery and onlybetting on prime numbers. So far, he has been using any regular prime numbers and his luck at winninghas not been very good. He has decided to start betting only on reversible prime numbers, hoping thathis luck will improve. A reversible prime is a prime number whose ’reverse’ is also a prime. To reverse anumber, write it down on paper, and then read it backwards. For example, the reverse of 12345 is 54321.

One such reversible prime is 17, since its reversal, 71 is also a prime. Another example is 13, as 31 alsoshares the prime number property. Note that while 41 is a prime, 14 is not!

F. Moneybags III quickly found out that calculating these numbers takes too long. You see, Rich only usespencil and paper for calculations, so he doesnt get very far and he quickly gets tired. He has summonedyou to generate a list of reversible primes for him within a given range. He expects a fast turn-aroundtime so that he can go back to playing his lottery. We are sorry to say, but Sir Filthy Rich Moneybagshe wont be paying you for your efforts. But perhaps he will be generous to you when he wins a jackpotusing the numbers youve generated? I wouldnt bet on it . . .

Input

Input will consist of multiple test cases. Each test case consists of a pair of integers [A,B], where1 ≤ A ≤ 4, 000, 000 and A ≤ B ≤ 4, 000, 000. The last line will contain two zeroes, to indicate the end ofinput and should not be processed.

Output

For each test case, output the number of reversible primes within the given range. Each case shouldappear on a single line by itself.

Example

Input Output

1 23

1 101

4 6

0 0

7

14

1

Page 12 of 15

Page 14: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem I. Double Dealing

Take a deck of n unique cards. Deal the entire deck out to k players in the usual way: the top card toplayer 1, the next to player 2, the kth to player k, the k + 1st to player 1, and so on. Then pick up thecards - place player 1’s cards on top, then player 2, and so on, so that player k’s cards are on the bottom.Each player’s cards are in reverse order - the last card that they were dealt is on the top, and the firston the bottom.

How many times, including the first, must this process be repeated before the deck is back in its originalorder?

Input

There will be multiple test cases in the input. Each case will consist of a single line with two integers, nand k (1 ≤ n ≤ 800, 1 ≤ k ≤ 800). The input will end with a line with two 0s.

Output

For each test case in the input, print a single integer, indicating the number of deals required to returnthe deck to its original order. Output each integer on its own line, with no extra spaces, and no blanklines between answers. All possible inputs yield answers which will fit in a signed 64-bit integer.

Example

Input Output

1 3

10 3

52 4

0 0

1

4

13

Problem D from The University of Chicago Invitational Programming Contest 2012

Page 13 of 15

Page 15: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Problem J. Trash Removal

Allied Chute Manufacturers is a company that builds trash chutes. A trash chute is a hollow tubeinstalled in buildings so that trash dropped in at the top will fall down and be collected in the basement.Designing trash chutes is actually highly nontrivial. Depending on what kind of trash people are expectedto drop into them, the trash chute needs to have an appropriate size. And since the cost of manufacturinga trash chute is proportional to its size, the company always would like to build a chute that is as smallas possible. Choosing the right size can be tough though.

We will consider a 2-dimensional simplification of the chute design problem. A trash chute points straightdown and has a constant width. Objects that will be dropped into the trash chute are modeled aspolygons. Before an object is dropped into the chute it can be rotated so as to provide an optimal fit.Once dropped, it will travel on a straight path downwards and will not rotate in flight. The followingfigure shows how an object is first rotated so it fits into the trash chute.

Your task is to compute the smallest chute width that will allow a given polygon to pass through

Input

The input contains several test cases. Each test case starts with a line containing an integer n(3 ≤ n ≤ 100), the number of points in the polygon that models the trash item.

The next n lines then contain pairs of integers xi and yi (0 ≤ xi, yi ≤ 104), giving the coordinates ofthe polygon vertices in order. All points in one test case are guaranteed to be mutually distinct and thepolygon sides will never intersect. (Technically, there is one inevitable exception of two neighboring sidessharing their common vertex. Of course, this is not considered an intersection.)

The last test case is followed by a line containing a single zero.

Page 14 of 15

Page 16: Univerisity of Michigan ACM ICPC Quali er 2012 Problem A Circles …programmingteam.cc.gatech.edu/contest/UMichQuals2012/... · 2018-01-22 · University of Michigan ACM ICPC Quali

University of Michigan ACM ICPC Qualifiers 2012

Output

For each test case, display its case number followed by the width of the smallest trash chute throughwhich it can be dropped. Display the minimum width with exactly two digits to the right of the decimalpoint, rounding up to the nearest multiple of 1/100. Answers within 1/100 of the correct rounded answerwill be accepted.

Follow the format of the sample output.

Example

Input Output

3

0 0

3 0

0 4

4

0 10

10 0

20 10

10 20

0

Case 1: 2.40

Case 2: 14.15

ICPC 2011 World Finals Problem K: Trash Removal

Page 15 of 15