********************************************************************** BRONZE PROBLEMS ********************************************************************** Four problems numbered 11 through 14 ********************************************************************** Problem 11: Binary Numbers [Traditional, 2004] Given a positive integer A (0 <= A <= 2,110,000,000), print its binary (base two) representation (without extra leading zeroes, of course). Do not use automatic conversion routines or automatic binary printing routines. PROBLEM NAME: binnum INPUT FORMAT: * Line 1: An integer SAMPLE INPUT (file binnum.in): 277309 OUTPUT FORMAT: * Line 1: The binary representation of the input integer SAMPLE OUTPUT (file binnum.out): 1000011101100111101 ********************************************************************** Problem 12: Bank Balance [Rob Kolstad, 2004] Alice, Betsy, Corinne, and Debra have opened bank accounts. The bank has kept a central ledger of their deposits (money into the bank) and withdrawals (money out of the bank). They are good financial citizens and never withdraw more money than they have. Given the ledger (see format below), print the amount of money each has in the bank after the ledger's transactions are completed. The initial balance for each is, of course, 0. All numbers fit into 32 bit integers. PROBLEM NAME: bankbal INPUT FORMAT: * Line 1: A single integer N, the number of transactions * Lines 2..N+1: Each line contains a single transaction with two fields. The first field is the name of the person performing the transaction. The second field is a number: if positive, the number is a deposit; if negative, the number is a withdrawal. SAMPLE INPUT (file bankbal.in): 6 Alice +100 Corinne +100 Betsy +200 Alice -10 Debra +10 Betsy -100 INPUT DETAILS: Alice deposits 100; so does Corrinne. Betsy deposits 200. Alice takes out 10; Debra puts in 10. Betsy takes out 100. The input never contains names other than 'Alice', 'Betsy', 'Corinne', and 'Debra'. OUTPUT FORMAT: * Lines 1..4: Each line tells the name and balance of one of the depositors. The depositors are listed in alphabetical order. SAMPLE OUTPUT (file bankbal.out): Alice 90 Betsy 100 Corinne 100 Debra 10 ********************************************************************** Problem 13: Satellite Photo [Brian Dean, 2004] Farmer John always wanted a good map of his farm, so he purchased a satellite photograph of his land which is represented by R (1 <= R <= 75) rows and C (1 <= C <= 75) columns in the photo. One part of a photo looks something like this: .................. ..#####.......##.. ..#####......##... .................. #.......###.....#. #.....#####....... In trying to interpret the photo, he figures that every connected shape is either a barn or a cow. A "connected shape" is a set of one or more #'s that are adjacent to each other either vertically or horizontally. The following would be two distinct "connected shapes": .... .#.. ..#. .... FJ claims that a connected shape is a barn if it is a filled-in rectangle whose four sides are parallel to the x and y axes. In the first photo above, there are three barns (sizes 2x1, 2x5, and 1x1) and two cows (you'd be surprised at the size of some of FJ's cows!). Count the number of barns and cows in his satellite photo. A cow never completely encircles another cow or barn. PROBLEM NAME: satel INPUT FORMAT: * Line 1: Two space-separated integers: R and C. * Lines 2..R+1: Line i+1 represents row i of the photograph and contains C characters (and no spaces). SAMPLE INPUT (file satel.in): 5 8 #####..# #####.## ......#. .###...# .###..## INPUT DETAILS: The photo consists of 5 lines, each of which is 8 characters long. OUTPUT FORMAT: * Line 1: The number of barns in the photo. * Line 2: The number of cows in the photo. SAMPLE OUTPUT (file satel.out): 2 2 OUTPUT DETAILS: The photo has 2 barns (the shapes on the left) and 2 cows (on the right). ********************************************************************** Problem 14: Plate Stacking [Rob Kolstad, 2005] The cows want to be on TV. They've decided their best chance is to demonstrate their prowess in stacking plates as high as they possibly can. They hope to maximize entertainment value by stacking certain plates that are thrown from stage left toward stage center. Of course, plates can only be stacked when a strictly smaller plate is stacked upon a larger plate. Thus, some plates might be discarded. Given the sequence of integer of N (1 <= N <= 5,000) plate thrown from the side of the stage, calculate the height (in plates) of the tallest possible plate-stacking structure that can be build. Sizes are integers in the range 1..1,000,000. If the plates were thrown on this order: 7 10 7 8 9 7 8 6 4 Then the tallest possible stack would be 10, 9, 8, 6, 4 whose height is 5. Solve this problem perfectly to earn an invitation to the Silver division. PROBLEM NAME: plates INPUT FORMAT: * Line 1: A single integer, N * Lines 2..N+1: Line i+1 describes the i_th plate tossed from the side of the stage. SAMPLE INPUT (file plates.in): 9 7 10 7 8 9 7 8 6 4 OUTPUT FORMAT: * Line 1: A single line with the maximum height of plates that can be stacked. SAMPLE OUTPUT (file plates.out): 5 **********************************************************************