当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1648:Countryside Highway

题目描述
Regional government wishes to build a new highway across the region, and it seems that the best route for the highway goes across the Kvadratnaya village. The village consists of the N x N square estates. All estates have a size of 100 by 100 meters. Therefore, in the coordinate system tied to the village, the southwestern corner of the village has coordinates (0, 0), and northeastern corner - coordinates (N*100, N*100). The highway will cross the village form the west to the east side, cutting through several estates. The government decided to compensate owners of those estates, and to estimate the necessary expenses one should calculate the number of estates crossed by the highway.

Given the village size N and the coordinates of the points where the highway crosses eastern and western borders of the village, you must find the number of estates. You can assume, for the purpose of increasing the financial appeal of the highway project, that the highway is a straight line (i.e. has zero width). If the highway just touches the edge of an estate, it is still considered a crossing.

The highway is a line between points (0, W) and (100*N, E).

输入解释
In the input, there are three integers, N (1 <= N <= 100), W and E, (0 <= W, E <= 100*N) separated by spaces.

Process to the end of file.
输出解释
Output must contain a single integer - the number of estates crossed by the highway.
输入样例
3 150 50
输出样例
4

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1648

最后修改于 2020-10-29T06:09:58+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536