The 2008 ACM North Central North America Regional Programming Contest Sponsored by IBM Judge’s Input and Expected Output This document has pages that represent the expected output for each problem in the contest. Some differences between this output and that produced by a correct solution might exist for some problems. Most of these differences are described in the Judging Tips document. Formatting differences, where formatting is not explicitly specified in the problem statement, are rarely ever a cause for a submission being judged incorrect. When in doubt, refer to the Judging Notes or query the regional contest director (stanw@unomaha.edu, 402-554-3583). It is extremely important that ALL TEAMS RECEIVE SIMILAR RESPONSES FOR SIMILAR RESULTS. The first error noted by a judge is the one to be reported to a team. This might not be the first actual error in the output, although in most cases it is. PLEASE RESIST THE TEMPTATION TO GIVE “HELPFUL HINTS” TO TEAMS. IT IS UNFAIR TO TEAMS AT OTHER SITES FOR YOU TO DO SO. IN THE EXTREME, IT COULD RESULT IN DISQUALIFICATION OF ONE OR MORE TEAMS. The Input The input data shown on these pages was prepared by inserting the actual judge’s test data files into this document, and they should therefore be identical to those found in the “JudgingData” directory on the CD. In some cases the input was displayed in several columns, but this should be apparent. Also, there is considerable input for problem 2, and not all of it is shown in this document. The Output The output shown here was produced by running the solution(s) to each problem using the judge’s test data. Judge’s Input and Expected Output Page 1 Problem 1 – Soundex Input Output Euler Gauss Hilbert Knuth Lloyd Lukasiewicz Ellery Ghosh Heilbronn Kant Ladd Lissajous Rogers Rodgers Sinclair StClair Tchebysheff Chebyshev . E460 G200 H416 K530 L300 L222 E460 G200 H416 K530 L300 L222 R262 R326 S524 S324 T212 C121 Judge’s Input and Expected Output Euler Gauss Hilbert Knuth Lloyd Lukasiewicz Ellery Ghosh Heilbronn Kant Ladd Lissajous Rogers Rodgers Sinclair StClair Tchebysheff Chebyshev Page 2 Problem 2 – Election Results Some input lines are very long. No attempt has been made to identify them uniquely in this printed listing. Please look at the actual input file, judge02.in, if details are required. Input 2 6 President: X Buruni Amabo Gomaa VicePresident: x Buruni Chakravarti President: Buruni X Amabo Gomaa VicePresident: Buruni Chakravarti President: Buruni X Amabo Gomaa VicePresident: X Buruni x Chakravarti President: Buruni x Amabo Gomaa VicePresident: Buruni x Chakravarti President: @ Buruni Amabo Gomaa VicePresident: Buruni x Chakravarti President: Buruni Amabo x Gomaa VicePresident: x Buruni Chakravarti 2 7 ChiefCook: x Fred Bob Sue Joe BottleWasher: X Joe Fred Sue Bob ChiefCook: x Fred Bob Sue Joe BottleWasher: x Fred Sue Joe Bob ChiefCook: Fred x Bob Sue Joe BottleWasher: x Fred Sue Joe Bob ChiefCook: Fred x Bob Sue Joe BottleWasher: x Fred x Sue x Joe x Bob ChiefCook: Fred Bob Sue Joe x BottleWasher: x Fred Sue Joe Bob ChiefCook: Fred Bob Sue Joe BottleWasher: x Fred Sue Joe Bob ChiefCook: Fred Bob Sue x Joe BottleWasher: x Fred Sue x Joe Bob 2 2 high: X Person1 Person2 low: Person1 Person2 high: Person1 x Person2 low: Person1 Person2 7 5 Chairman: x Jeff Bob CEO: Jeff Bob CAO: x COO: CTO: CFO: CCD: Xx Chairman: CEO: x CAO: COO: CTO: CFO: CCD: Xx Chairman: CEO: x z Jeff x x X Jeff x Bob Dave Kimo Jeff x Jeff Bob Dave Kimo Jeff Bill Jeff Judge’s Input and Expected Output Bill Jim Bill c Bob Jim Bob Bill Bob x Bob Bill x Bob Bill x x Bob x Bob Jim Bob Bob Bob x x Bill x Dave Dave Jim x Rich Rich x Jeff Jim Dave Dave Jim Rich Rich Jeff Jim Dave Page 3 CAO: COO: CTO: CFO: CCD: Xx Chairman: CEO: CAO: COO: CTO: CFO: CCD: Chairman: CEO: CAO: COO: CTO: CFO: CCD: Xx x Bob Dave Kimo Jeff Bill Jeff x z Jeff Bob Dave Kimo Jeff Bill Jeff x Bill x x Bob Bob x x Bob Jim Bob x x Bill x x Xx Bob Jeff Bob Dave Kimo Jeff Bill x Jeff Bill Bob Bob Jim Bob Bob Bob x Bob Jim Bob Bob Dave Jim Rich Rich Jim Dave Jim Rich Rich Dave Jeff Bill Bill x c Jim Dave Jim Rich Rich Jeff x Dave x 10 1 office-0: Schell Hill Smith Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller Swartz Field Derrick Cargill office-1: Deitel Olson Wagner Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck office-2: Stallings Ridge Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley office-3: Kessler Ben-Ari Boswell Dijkstra Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White office-4: Zajcew Wright Worthington Bartet West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf office-5: Chen Corbato Russinovich Holt Courtois Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser office-6: Smith Jones Fogel Langerman Messmer Quarterman Ousterhout McKeeman Randell office-7: Smith office-8: Smith office-9: Smith 10 1 office-0: Schell Hill Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller Swartz Field Derrick Cargill Deitel Olson Wagner Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck Stallings Ridge Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley Kessler Ben-Ari Boswell Dijkstra Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White Zajcew Wright Worthington Bartet West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf Chen Corbato Russinovich Holt Courtois Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser Smith Jones Fogel Langerman Messmer Quarterman Ousterhout McKeeman Randell Office-1: Smith Office-2: Smith Office-3: Smith Office-4: Smith Office-5: Smith Office-6: Smith Office-7: Smith Judge’s Input and Expected Output Page 4 office-8: Smith office-9: Smith 10 4 office-0: x Schell Hill Smith Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller Swartz Field Derrick Cargill office-1: Deitel x Olson Wagner Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck office-2: Stallings Ridge x Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley office-3: Kessler Ben-Ari Boswell x Dijkstra Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White office-4: Zajcew Wright Worthington Bartet x West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf office-5: Chen Corbato Russinovich Holt Courtois x Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser office-6: Smith Jones Fogel Langerman Messmer Quarterman x Ousterhout McKeeman Randell office-7: x Smith office-8: x Smith office-9: x Smith Jones office-0: x Schell Hill Smith Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller Swartz Field Derrick Cargill office-1: Deitel Olson Wagner x Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck office-2: Stallings Ridge x Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley office-3: Kessler Ben-Ari Boswell Dijkstra x Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White office-4: Zajcew Wright Worthington Bartet X West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf office-5: Russinovich Holt Courtois Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser X Chen Corbato office-6: Smith Jones Fogel Langerman Messmer Quarterman x Ousterhout McKeeman Randell office-7: x Smith office-8: x Smith office-9: Smith x Jones office-0: Schell Hill Smith Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller X Swartz Field Derrick Cargill office-1: Deitel Olson Wagner x Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck office-2: Stallings Ridge x Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley office-3: Kessler Ben-Ari Boswell Dijkstra x Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White office-4: Zajcew Wright Worthington Bartet X West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf office-5: Holt Courtois Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser X Chen Corbato Russinovich office-6: Smith Jones Fogel Langerman Messmer Quarterman x Ousterhout McKeeman Randell office-7: x Smith x office-8: x Smith office-9: x Smith Jones office-0: Schell Hill Smith Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller X Swartz Field Derrick Cargill office-1: Deitel Olson Wagner x Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck Judge’s Input and Expected Output Page 5 office-2: Stallings Ridge x Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley office-3: Kessler Ben-Ari Boswell Dijkstra x Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White office-4: Zajcew Wright Worthington Bartet X West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf office-5: Dawson Fotheringham Harris Montague Feustal X Dibona Graham Weiser Chen Corbato Russinovich Holt Courtois Herborth office-6: Smith Jones Fogel Langerman Messmer Quarterman x Ousterhout McKeeman Randell office-7: x Smith office-8: Smith office-9: x Smith Jones 10 120 office-0: Schell Hill Brown Kuck Stephens Greene Klauser Hoffman Bingham Gardner Miller Swartz Field Derrick Cargill Deitel Olson Wagner Teague Perlman Tsao Kurzweil Polya Horowitz Berlinski Richter Horswill Tavris Aronson Beck Stallings Ridge Druschel Kefir Cooper Bacon Panwar Young Woodside Love Rashid Jacob Feitelson Carr Lee Barkley Kessler Ben-Ari Boswell Dijkstra Herlihy Eskicioglu Enger Howerton Finkel Guynes LaRowe Korson Eager Sinha White Zajcew Wright Worthington Bartet West Floyd Bartowski Kang Jul Letwin Knuth Swift Vogels Dodge Boehm Cerf Chen Corbato Russinovich Holt Courtois Herborth Dawson Fotheringham Harris Montague Feustal Dibona Graham Weiser Smith Jones Fogel Langerman Messmer Quarterman Ousterhout McKeeman Randell Office-1: x Smith Office-2: Smith Office-3: Smith Office-4: Smith Office-5: Smith Office-6: Smith Office-7: Smith office-8: Smith office-9: Smith 119 similar ballots were omitted from this display; see the actual file, judge02.in, if more detail is needed. 1 2 Office-1: x Wolfeschlegelsteinhausenbergerdorffvoralternwarengewissenhaftschaferswesenchafe warenwholgepflegeundsorgfaltigkeitbeschutzenvonangereifenduchihrraubgiriigfeind ewelchevorralternzwolftausendjahresvorandieerscheinenbanderersteerdeemmeshedrra umschiffgebrauchlichtalsseinursprungvonkraftgestartseinlangefahrthinzwischenste rnartigraumaufdersuchenachdiesternwelshegehabtbewohnbarplanetenkreisedrehensich undwohinderneurassevanverstandigmenshlichkeittkonntevortpflanzenundsicherfreuna nlebenslamdlichfreudeundruhemitnichteinfurchtvorangreifenvonandererintlligentge schopfsvonhinzwischensternartigraum Smith Office-1: Wolfeschlegelsteinhausenbergerdorffvoralternwarengewissenhaftschaferswesenchafe warenwholgepflegeundsorgfaltigkeitbeschutzenvonangereifenduchihrraubgiriigfeind ewelchevorralternzwolftausendjahresvorandieerscheinenbanderersteerdeemmeshedrra umschiffgebrauchlichtalsseinursprungvonkraftgestartseinlangefahrthinzwischenste rnartigraumaufdersuchenachdiesternwelshegehabtbewohnbarplanetenkreisedrehensich undwohinderneurassevanverstandigmenshlichkeittkonntevortpflanzenundsicherfreuna nlebenslamdlichfreudeundruhemitnichteinfurchtvorangreifenvonandererintlligentge schopfsvonhinzwischensternartigraum x Smith 0 0 Judge’s Input and Expected Output Page 6 As with the input, some of the output lines are very long. No attempt has been made to identify them uniquely in this printed listing. Please look at the actual input file, judge02.out, if details are required. Output Election 1 results: President: Amabo 3 VicePresident: Buruni Chakravarti 2 Invalid ballots: 3, 5 Election 2 results: ChiefCook: Bob Fred 2 BottleWasher: Joe 1 Invalid ballots: 4, 5, 7 Election 3 results: high: Person1 Person2 1 low: --UNFILLED-Election 4 results: Chairman: Jeff 2 CEO: Dave 2 CAO: Bob 2 COO: Jim 2 CTO: Kimo Rich 1 CFO: --UNFILLED-CCD: Bill Xx 0 Invalid ballots: 1, 2, 3, 4, 5 Election 5 results: office-0: Bingham Brown Cargill Derrick Field Gardner Greene Hill Hoffman Klauser Kuck Miller Schell Smith Stephens Swartz 0 office-1: Aronson Beck Berlinski Deitel Horowitz Horswill Kurzweil Olson Perlman Polya Richter Tavris Teague Tsao Wagner 0 office-2: Bacon Barkley Carr Cooper Druschel Feitelson Jacob Kefir Lee Love Panwar Rashid Ridge Stallings Woodside Young 0 office-3: Ben-Ari Boswell Dijkstra Eager Enger Eskicioglu Finkel Guynes Herlihy Howerton Kessler Korson LaRowe Sinha White 0 office-4: Bartet Bartowski Boehm Cerf Dodge Floyd Jul Kang Knuth Letwin Swift Vogels West Worthington Wright Zajcew 0 office-5: Chen Corbato Courtois Dawson Dibona Feustal Fotheringham Graham Harris Herborth Holt Montague Russinovich Weiser 0 office-6: Fogel Jones Langerman McKeeman Messmer Ousterhout Quarterman Randell 0 office-7: --UNFILLED-office-8: --UNFILLED-office-9: --UNFILLED-Election 6 results: office-0: Aronson Bacon Barkley Bartet Bartowski Beck Ben-Ari Berlinski Bingham Boehm Boswell Brown Cargill Carr Cerf Chen Cooper Corbato Courtois Dawson Deitel Derrick Dibona Dijkstra Dodge Druschel Eager Enger Eskicioglu Feitelson Feustal Field Finkel Floyd Fogel Fotheringham Gardner Graham Greene Guynes Harris Herborth Herlihy Hill Hoffman Holt Horowitz Horswill Howerton Jacob Jones Jul Kang Kefir Kessler Klauser Knuth Korson Kuck Kurzweil LaRowe Langerman Lee Letwin Love McKeeman Messmer Miller Montague Olson Ousterhout Panwar Perlman Polya Quarterman Randell Rashid Richter Ridge Russinovich Schell Sinha Smith Stallings Stephens Swartz Swift Tavris Teague Tsao Vogels Wagner Weiser West White Woodside Worthington Wright Young Zajcew 0 Judge’s Input and Expected Output Page 7 Office-1: Office-2: Office-3: Office-4: Office-5: Office-6: Office-7: office-8: office-9: --UNFILLED---UNFILLED---UNFILLED---UNFILLED---UNFILLED---UNFILLED---UNFILLED---UNFILLED---UNFILLED-- Election 7 results: office-0: Schell Swartz 2 office-1: Teague 3 office-2: Druschel 4 office-3: Herlihy 3 office-4: West 4 office-5: Chen 2 office-6: Ousterhout 4 office-7: Smith 3 office-8: --UNFILLED-office-9: Jones 1 Invalid ballots: 3 Election 8 results: office-0: Schell 2 Office-1: Smith 1 Office-2: --UNFILLED-Office-3: --UNFILLED-Office-4: --UNFILLED-Office-5: --UNFILLED-Office-6: --UNFILLED-Office-7: --UNFILLED-office-8: --UNFILLED-office-9: --UNFILLED-Election 9 results: Office-1: Smith Wolfeschlegelsteinhausenbergerdorffvoralternwarengewissenhaftschaferswesenchafe warenwholgepflegeundsorgfaltigkeitbeschutzenvonangereifenduchihrraubgiriigfeind ewelchevorralternzwolftausendjahresvorandieerscheinenbanderersteerdeemmeshedrra umschiffgebrauchlichtalsseinursprungvonkraftgestartseinlangefahrthinzwischenste rnartigraumaufdersuchenachdiesternwelshegehabtbewohnbarplanetenkreisedrehensich undwohinderneurassevanverstandigmenshlichkeittkonntevortpflanzenundsicherfreuna nlebenslamdlichfreudeundruhemitnichteinfurchtvorangreifenvonandererintlligentge schopfsvonhinzwischensternartigraum 1 Judge’s Input and Expected Output Page 8 Problem 3 – Cannonball Pyramids Input 100 399 925 653 219 464 546 140 782 988 745 847 674 492 509 807 590 336 380 5 945 269 514 26 136 183 114 981 551 536 683 37 518 695 378 318 674 659 402 617 348 798 837 531 330 383 237 415 736 119 243 464 219 790 283 679 914 726 906 851 233 372 542 838 683 399 688 523 995 681 864 630 263 522 510 708 426 948 936 842 508 554 85 537 968 201 996 982 859 600 450 144 76 524 230 99 804 308 651 401 890 Output 1: 399 10666600 2: 925 132336975 3: 653 46620935 4: 219 1774630 5: 464 16757360 6: 546 27277796 7: 140 467180 8: 782 80007984 9: 988 161226780 10: 745 69193365 11: 847 101633224 12: 674 51257700 13: 492 19970444 14: 509 22108415 15: 807 87918884 16: 590 34404080 17: 336 6378736 18: 380 9217660 19: 5 35 20: 945 141098265 21: 269 3280455 22: 514 22765060 23: 26 3276 24: 136 428536 25: 183 1038220 26: 114 253460 27: 981 157827531 28: 551 28032676 29: 536 25808936 30: 683 53335470 31: 37 9139 32: 518 23299640 33: 695 56192140 34: 378 9073260 35: 318 5410240 36: 674 51257700 37: 659 47915890 38: 402 10908404 39: 617 39338069 40: 348 7084700 41: 798 85013600 42: 837 98079939 43: 531 25094706 44: 330 6044060 45: 383 9437120 46: 237 2246839 47: 415 11998480 48: 736 66719136 49: 119 287980 50: 243 2421090 51: 464 16757360 52: 219 1774630 53: 790 82485480 54: 283 3817670 55: 679 52405220 56: 914 127676660 57: 726 64039976 58: 906 124356956 59: 851 103078226 60: 233 2135445 61: 372 8649124 62: 542 26683744 63: 838 98431480 64: 683 53335470 65: 399 10666600 Judge’s Input and Expected Output 66: 688 54513680 67: 523 23979550 68: 995 164674490 69: 681 52868981 70: 864 107868960 71: 630 41873160 72: 263 3066580 73: 522 23842524 74: 510 22238720 75: 708 59400020 76: 426 12975676 77: 948 142444900 78: 936 137109336 79: 842 99846044 80: 508 21978620 81: 554 28492220 82: 85 105995 83: 537 25953389 84: 968 151642040 85: 201 1373701 86: 996 165170996 87: 982 158310184 88: 859 106009190 89: 600 36180200 90: 450 15288900 91: 144 508080 92: 76 76076 93: 524 24117100 94: 230 2054360 95: 99 166650 96: 804 86943220 97: 308 4917220 98: 651 46194526 99: 401 10827401 100: 890 117891180 Page 9 Problem 4 – Pencils from the Nineteenth Century Input 10 20 40 15 16 25 39 46 57 75 81 96 116 131 152 167 181 202 235 0 Output Case 1: 10 pencils for 10 cents No solution found. Case 2: 20 pencils for 20 cents 3 at four cents each 15 at two for a penny 2 at four for a penny Case 3: 40 pencils for 40 cents 6 at four cents each 30 at two for a penny 4 at four for a penny 7 at four cents each 15 at two for a penny 18 at four for a penny Case 4: 15 pencils for 15 cents No solution found. Case 5: 16 pencils for 16 cents 3 at four cents each 3 at two for a penny 10 at four for a penny Case 6: 25 pencils for 25 cents 4 at four cents each 15 at two for a penny 6 at four for a penny Case 7: 39 pencils for 39 cents 6 at four cents each 27 at two for a penny 6 at four for a penny 12 at two for a penny 20 at four for a penny Case 8: 46 pencils for 46 cents 7 at four cents each 33 at two for a penny 6 at four for a penny 8 at four cents each 18 at two for a penny 20 at four for a penny 9 at four cents each 3 at two for a penny 34 at four for a penny Case 9: 57 pencils for 57 cents 9 at four cents each 36 at two for a penny 12 at four for a penny 10 at four cents each 21 at two for a penny 26 at four for a penny 11 at four cents each 6 at two for a penny 40 at four for a penny Case 10: 75 pencils for 75 cents 11 at four cents each 60 at two for a penny 4 at four for a penny 12 at four cents each 45 at two for a penny 18 at four for a penny 13 at four cents each 30 at two for a penny 32 at four for a penny 14 at four cents each 15 at two for a penny 46 at four for a penny Case 11: 81 pencils for 81 cents 12 at four cents each 63 at two for a penny 6 at four for a penny 13 at four cents each 48 at two for a penny 20 at four for a penny 14 at four cents each 33 at two for a penny 34 at four for a penny 15 at four cents each 18 at two for a penny 48 at four for a penny 16 at four cents each 3 at two for a penny 62 at four for a penny 7 at four cents each Judge’s Input and Expected Output Page 10 Case 12: 96 pencils for 96 cents 14 at four cents each 78 at two for a penny 4 at four for a penny 23 at four cents each 48 at two for a penny 60 at four for a penny 15 at four cents each 63 at two for a penny 18 at four for a penny 24 at four cents each 33 at two for a penny 74 at four for a penny 16 at four cents each 48 at two for a penny 32 at four for a penny 25 at four cents each 18 at two for a penny 88 at four for a penny 17 at four cents each 33 at two for a penny 46 at four for a penny 26 at four cents each 3 at two for a penny 102 at four for a penny 18 at four cents each 18 at two for a penny 60 at four for a penny Case 15: 152 pencils for 152 cents 22 at four cents each 126 at two for a penny 4 at four for a penny 19 at four cents each 3 at two for a penny 74 at four for a penny 23 at four cents each 111 at two for a penny 18 at four for a penny Case 13: 116 pencils for 116 cents 17 at four cents each 93 at two for a penny 6 at four for a penny 24 at four cents each 96 at two for a penny 32 at four for a penny 18 at four cents each 78 at two for a penny 20 at four for a penny 25 at four cents each 81 at two for a penny 46 at four for a penny 19 at four cents each 63 at two for a penny 34 at four for a penny 26 at four cents each 66 at two for a penny 60 at four for a penny 20 at four cents each 48 at two for a penny 48 at four for a penny 27 at four cents each 51 at two for a penny 74 at four for a penny 21 at four cents each 33 at two for a penny 62 at four for a penny 28 at four cents each 36 at two for a penny 88 at four for a penny 22 at four cents each 18 at two for a penny 76 at four for a penny 29 at four cents each 21 at two for a penny 102 at four for a penny 23 at four cents each 3 at two for a penny 90 at four for a penny 30 at four cents each 6 at two for a penny 116 at four for a penny Case 14: 131 pencils for 131 cents 19 at four cents each 108 at two for a penny 4 at four for a penny Case 16: 167 pencils for 167 cents 24 at four cents each 141 at two for a penny 2 at four for a penny 20 at four cents each 93 at two for a penny 18 at four for a penny 25 at four cents each 126 at two for a penny 16 at four for a penny 21 at four cents each 78 at two for a penny 32 at four for a penny 26 at four cents each 111 at two for a penny 30 at four for a penny 22 at four cents each 63 at two for a penny 46 at four for a penny 27 at four cents each 96 at two for a penny 44 at four for a penny Judge’s Input and Expected Output Page 11 28 at four cents each 81 at two for a penny 58 at four for a penny Case 18: 202 pencils for 202 cents 29 at four cents each 171 at two for a penny 2 at four for a penny 29 at four cents each 66 at two for a penny 72 at four for a penny 30 at four cents each 156 at two for a penny 16 at four for a penny 30 at four cents each 51 at two for a penny 86 at four for a penny 31 at four cents each 141 at two for a penny 30 at four for a penny 31 at four cents each 36 at two for a penny 100 at four for a penny 32 at four cents each 126 at two for a penny 44 at four for a penny 32 at four cents each 21 at two for a penny 114 at four for a penny 33 at four cents each 111 at two for a penny 58 at four for a penny 33 at four cents each 6 at two for a penny 128 at four for a penny 34 at four cents each 96 at two for a penny 72 at four for a penny Case 17: 181 pencils for 181 cents 26 at four cents each 153 at two for a penny 2 at four for a penny 35 at four cents each 81 at two for a penny 86 at four for a penny 27 at four cents each 138 at two for a penny 16 at four for a penny 28 at four cents each 123 at two for a penny 30 at four for a penny 29 at four cents each 108 at two for a penny 44 at four for a penny 30 at four cents each 93 at two for a penny 58 at four for a penny 31 at four cents each 78 at two for a penny 72 at four for a penny 36 at four cents each 66 at two for a penny 100 at four for a penny 37 at four cents each 51 at two for a penny 114 at four for a penny 38 at four cents each 36 at two for a penny 128 at four for a penny 39 at four cents each 21 at two for a penny 142 at four for a penny 40 at four cents each 6 at two for a penny 156 at four for a penny 32 at four cents each 63 at two for a penny 86 at four for a penny Case 19: 235 pencils for 235 cents 34 at four cents each 195 at two for a penny 6 at four for a penny 33 at four cents each 48 at two for a penny 100 at four for a penny 35 at four cents each 180 at two for a penny 20 at four for a penny 34 at four cents each 33 at two for a penny 114 at four for a penny 36 at four cents each 165 at two for a penny 34 at four for a penny 35 at four cents each 18 at two for a penny 128 at four for a penny 37 at four cents each 150 at two for a penny 48 at four for a penny 36 at four cents each 3 at two for a penny 142 at four for a penny 38 at four cents each 135 at two for a penny 62 at four for a penny Judge’s Input and Expected Output Page 12 39 at four cents each 120 at two for a penny 76 at four for a penny 40 at four cents each 105 at two for a penny 90 at four for a penny 41 at four cents each 90 at two for a penny 104 at four for a penny 42 at four cents each 75 at two for a penny 118 at four for a penny 43 at four cents each 60 at two for a penny 132 at four for a penny 44 at four cents each 45 at two for a penny 146 at four for a penny 45 at four cents each 30 at two for a penny 160 at four for a penny 46 at four cents each 15 at two for a penny 174 at four for a penny Judge’s Input and Expected Output Page 13 Problem 5 – Fibonacci Period Input 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 12345678 12345679 1000000000 1073741823 0 Output 1: 2 3 2: 3 8 3: 4 6 4: 5 20 5: 6 24 6: 7 16 7: 8 12 8: 9 24 9: 10 60 10: 11 10 11: 12 24 12: 13 28 13: 14 48 14: 15 40 15: 16 24 16: 17 36 17: 18 24 18: 19 18 19: 20 60 20: 21 16 21: 12345678 700512 22: 12345679 12679384 23: 1000000000 1500000000 24: 1073741823 13200 Judge’s Input and Expected Output Page 14 Problem 6 – Painted Calculator Input 10 10 30 30 30 0 10 20 65 65 95 5 30 60 65 95 Output Case Case Case Case Case 1: 2: 3: 4: 5: No solutions. 4 solutions. 516 solutions. 819 solutions. 304 solutions. Judge’s Input and Expected Output Page 15 Problem 7 – 3-Trees Input 10 2 43 7 1 8 6 5 0 220 631 571 332 104 502 567 854 0 291 845 152 585 193 810 173 484 151 366 491 0 265 893 220 631 571 332 104 502 567 854 40 108 639 13 720 101 482 254 676 896 759 720 907 928 377 899 778 324 194 995 161 708 501 936 716 105 209 559 705 78 510 0 274 638 448 39 467 77 38 160 397 0 534 686 272 465 276 450 935 86 453 945 855 120 14 234 866 437 769 874 376 944 798 838 946 586 599 319 421 904 158 835 Judge’s Input and Expected Output 731 491 0 119 48 426 325 104 428 623 618 779 488 0 495 550 90 963 0 706 435 766 887 18 66 197 554 0 674 897 696 835 0 68 795 929 375 802 538 181 69 8 196 491 846 882 351 890 753 242 770 582 52 379 91 887 807 0 298 337 909 0 417 227 462 588 665 293 939 437 598 533 853 994 387 37 120 615 165 256 219 388 95 530 296 184 202 0 0 Output Case Case Case Case Case Case Case Case Case Case Case Case Case 1: 1 3 1 2: 1 0 2 3: 0 2 1 4: 3 3 5 5: 1 1 1 6: 2 1 4 7: 1 1 4 8: 1 0 2 9: 1 1 2 10: 0 0 1 11: 1 1 2 12: 0 0 2 13: 1 2 5 Page 16 Problem 8 – Egyptian Multiplication Input 13 238 1000 1 1 1 255 255 23 42 42 23 63 377 377 63 64 64 64 63 63 64 -1 Output Case Case Case Case Case Case Case Case Case Case Case 1: 13 x 238 = 238 + 952 + 1904 2: 1000 x 1 = 8 + 32 + 64 + 128 + 256 + 512 3: 1 x 1 = 1 4: 255 x 255 = 255 + 510 + 1020 + 2040 + 4080 + 8160 + 16320 + 32640 5: 23 x 42 = 42 + 84 + 168 + 672 6: 42 x 23 = 46 + 184 + 736 7: 63 x 377 = 377 + 754 + 1508 + 3016 + 6032 + 12064 8: 377 x 63 = 63 + 504 + 1008 + 2016 + 4032 + 16128 9: 64 x 64 = 4096 10: 64 x 63 = 4032 11: 63 x 64 = 64 + 128 + 256 + 512 + 1024 + 2048 Judge’s Input and Expected Output Page 17 Problem 9 – Binary Clock Input 18 ()()(*)()(*)()(*)()()(*)()(*)(*)(*)()()()(*) h ()(*)(*)()()(*)(*)()()()(*)()(*)()()()(*)(*) v ()(*)(*)()()(*)()()()()()(*)()()()()()(*) h ()(*)()()()(*)()()()()()(*)()()()()(*)()()()() h (*)(*)(*)(*)(*)(*)()()()()()(*)()()()()()(*) h (*)(*)(*)(*)(*)(*)()()()()()(*)()()()()()(*)()()() h (*)(*)(*)(*)(*)()()()()()(*)()()()()()(*) h (x)(*)(*)(*)(*)(*)()()()()()(*)()()()()()(*) h ()()()()()(*)()()()()()(*)()()()()()(*) h ()()()()()()()()()()()()()()()(*)(*)(*) v ()()(*)()(*)()()(*)(*)()(*)(*)(*)(*)(*)()(*)(*) h ()()(*)()(*)(*)(*)(*)(*)()()()(*)(*)(*)()(*)(*) v ()()()()()(*)()()()()(*)()()()()()(*)(*) h ()()()()()()()()()()()()()(*)(*)(*)()(*) v ()(*)()(*)(*)(*)(*)(*)(*)()(*)(*)(*)(*)(*)()(*)(*) h ()(*)(*)(*)(*)(*)()(*)(*)(*)()()(*)(*)(*)(*)(*)(*) v ()()()()()()()()()()()()()()()()()() h ()()()()()()()()()()()()()()()()()() v Output Case Case Case Case Case Case Case Case Case Case Case Case Case Case Case Case Case Case 1: 10:37:49 2: 10:37:49 3: incorrect 4: incorrect 5: incorrect 6: incorrect 7: incorrect 8: incorrect 9: 1:01:01 10: 1:01:01 11: 10:27:59 12: 10:27:59 13: 1:02:03 14: 1:02:03 15: 23:59:59 16: 23:59:59 17: 0:00:00 18: 0:00:00 time syntax time syntax syntax syntax Judge’s Input and Expected Output Page 18