编程介的小学生 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 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler