编程介的小学生 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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分