编程介的小学生 2017-08-20 15:34 采纳率: 20.5%
浏览 693
已采纳

Knight in Corridor

A knight was trapped in a long and narrow corridor (2*n). The knight is asked to travel in the grids from one point and must return this point in the end. The path he passed will form a polygon; the edges of polygon should not touch each other. You are asked to compute the maximum area of the polygon. The following figure shows a series of possible moves of the knight, the point from A, B, C to D forms a polygon which area is 4. Note that from a point (x, y), the knight can only move to (x-2, y-1), (x-2, y+1), (x-1, y-2), (x-1, y+2), (x+1, y-2), (x+1, y+2), (x+2, y-1) or (x+2, y+1).

Input:

There are multiple test cases, each case consists of three integer, N, x and y (x <= N). N is the length of corridor which is not greater than 1000000000. (x, y) indicates the starting position of the knight. A test case with N = 0 indicates the end of input.

Output:

The maximum area (accurate to two fractional digits) of the polygon in each line. Assume the side length of grid is 1. If the required polygon does not exist, output "wuwuwu".

Sample Input:
4 0 1
4 0 0
0

Sample Output:
4.00
wuwuwu

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器