from: Southeastern Small College Computing Conference 1996 Programming Contest
Kirk: "Get us out of here, Mr. Scott!"
Scotty: "She canna take much more of this Cap'n!"
Spock: "Interesting."
Kirk: "Report Bones?"
McCoy: "*&^&$#@ it Jim, I'm just a doctor!"
Scotty: "She's gonna blow up, Cap'n!"
Spock: "Fascinating."
Kirk: " (grasping the helm with his trademark wild-eyed look) "Then let it blow. At least we'll take those tribble with us! At least we'll die free: Ah, freedom, that noble state in which all men yearn to live; that blessed...." McCoy" (Grabbing Kirk's arm with his trademark ornery old man look) "Shut up, Jim!"
(turning to Spock) "Why don't YOU do something, Mr. Smarty-Pants-Pointy-Eared-Halfbreed??"
Spock: "It would be illogical to do nothing. In fact, doctor, while you and the others have been shaelessly displaying your human emotions, I have been calculating the amount of time we have remaining until the warp core collapses upon itself. My calculations show that we can stop this catastrophe from occurring if we direct a high-power quantum phase hole in time neutrino subspace blast toward the warp engines when the tribble count reaches exactly.....
Suddenly Spock's eyes roll back in his head and his body goes rigid.
McCoy: "%#$$@& it Spock! Didn't I tell you to keep a little something on your tummy? Low blood sugar isn't something to screw around with! Now look what's happened!"
With Spock unable to speak and move, the crew looks to you to finish Spock's calculations and save the ship. Here's the situation: A nasty colony of Tribbles has set up a breeding ground in the warp core of the Enterprise. The trouble with tribbles is their unbelievably fast rate of reproduction. If the triblles are not stopped soon, the sheer number of them in the engine will casue the ship to explode. Currently there are 2187 tribbles in the engine. Each tribble autonomously reproduces at the rate of 3 per hour; that is, each single tribble splits into three new tribbles once each hour. Now, for reasons not understood (even by Spock), tribbles are vulnerable to high-power quantum phase hole in time neutrino subspace blasts during their 15th hour of reproduction. The crew doesn't know when the tribbles began reproducing, but they do know that it all started with only one tribble.
Write a program that tells Kirk when to give the engine a high-power quantum phase hole in time neutrino subspace blast by giving the count of tribbles that would be present after 15 hours of reproduction and the number of hours remaining until the blast must be given.