编程介的小学生 2017-09-12 00:59 采纳率: 20.5%
浏览 675
已采纳

Playing with a Calculator

Pete is playing a game. He types on a calculator a natural number K and then presses the '+' key. The display still shows K. Pete wants to have on the display a number that is formed using only one figure. In order to get that he presses, if it is necessary, the '=' key several times (maybe 0). The result after the first pressing is K+K. After each pressing the number K is added to the sum. Find out whether Pete will achieve his goal or not, and what number, consisting all of identical figures, he will get first. Consider the capacity of the calculator to be unlimited.
K < 1000

Input

The input file contains the number K.

Process to the end of file.

Output

The output file must contain two numbers: first the figure that forms the result and then the number of digits of the result. If multiple solution exists, first minimize the figure then minimize the number of digits. If finding the desired result is impossible, the output file must contain only one number -1 (minus 1). The numbers in the output file must be separated by one space.

Sample Input

37

Sample Output

1 3

  • 写回答

2条回答

  • threenewbee 2017-09-12 16:41
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题