SHENZHEN I/O

SHENZHEN I/O

评价数不足
Tesla Challenge 22: City Planning Tool
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
1.865 KB
2017 年 4 月 8 日 上午 11:25
1 项改动说明 ( 查看 )

订阅以下载
Tesla Challenge 22: City Planning Tool

在 89o 的 1 个合集中
SHENZHEN I/O Tesla Challenge Pack
24 件物品
描述
Subject: Important!
From: Wu Lili 吴丽丽 <wulili@longteng-co-ltd.gd.cn>

It seems as though Sun Haotian has a big project in mind, like a whole city. He has contacted us to create a simple city planner for him. All it does is work out the lengths of a triangle's edges, but he says he wants hundreds of devices like this alone. We must do our best work here.

Subject: Re: Important!
From: Carl Tesky <carl@longteng-co-ltd.gd.cn>

In case you didn't know, I'll tell you the distance formula: if x1 and y1 are the coordinates of point 1, and x2 and y2 are the coordinates of point 2, according to Pythagoras' theorem the distance between them is

sqrt((x1-x2)^2+(y1-y2)^2)

---------

Small hint: Yes, you will need to implement a square root calculator. This time there is no way around it.

Big hint: To calculate the floor function of the square root, test all perfect squares until you get one that is greater than the input. Then subtract 1.

Optimization tip: Squaring a number is as easy as doing
mul acc