Calculator Conundrum
来源:UVA
标签:
参考资料:《算法竞赛入门经典——训练指南》
相似题目:
题目
Alice got a hold of an old calculator that can display n digits. She was bored enough to come up with the following time waster. She enters a number k then repeatedly squares it until the result overflows. When the result overflows, only the n most significant digits are displayed on the screen and an error flag appears. Alice can clear the error and continue squaring the displayed number. She got bored by this soon enough, but wondered: “Given n and k, what is the largest number I can get by wasting time in this manner?”