编程介的小学生 2017-01-04 07:04 采纳率: 20.5%
浏览 919
已采纳

Cheat

问题描述 :

In the summer of last year, Lemon, Yifenfei and CTW live in the same apartment. They usually played some game after they came back from lab. One day, Yifenfei came up with an idea about a new game. That game’s rules are as follows:
Yifenfei provides a positive integer n, Lemon and CTW should give 3 positive integers x, y and z in a limited time. The winner is who make the |n – x * y * z| as small as possible. If the value of |n – x * y * z| is tied, the rusult is determined by smaller x, then smaller y, then smaller z, until the winner appear. To make this game more diffcult, Yifenfei will also give a list of positive integers, x, y and z cannot be included in this list.
Because Lemon is so smart, CTW never win even one game. Can you provides CTW a program to help him to get the optimum answer?
输入:

Input includes several cases. The first line of a case contains two integers t, n. Then follows t positive integers in the seconde line.Input ends with a case t = 0 and n = 0. 0 <= t <= 50, 0 < n <= 1000.
输出:

Input includes several cases. The first line of a case contains two integers t, n. Then follows t positive integers in the seconde line.Input ends with a case t = 0 and n = 0. 0 <= t <= 50, 0 < n <= 1000.
样例输入:

1 1
1
2 10
1 2
0 0
样例输出:

2 2 2
3 3 3

  • 写回答

1条回答

  • threenewbee 2017-01-11 16:44
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题