当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
An infinite chessboard is obtained by extending a finite chessboard to the right and up infinitely. Each square of the chessboard is either black or white with the side of S milimiters, 0 < S <= 1000. The leftmost bottom square of the chessboard is black. A flea is positioned on the chessboard at the point (x, y) (given in milimeters) and makes jumps by jumping dx milimeters to the right and dy milimiters up, 0 < dx, dy, that is, a flea at position (x, y) after one jump lands at position (x+dx, y+dy).
10 2 3 3 2 100 49 73 214 38 25 0 0 5 25 407 1270 1323 1 1 18 72 6 18 6 407 1270 1170 100 114 0 0 0 0 0
After 3 jumps the flea lands at (11, 9). After 1 jumps the flea lands at (263, 111). The flea cannot escape from black squares. After 306 jumps the flea lands at (1576, 1629). The flea cannot escape from black squares. After 0 jumps the flea lands at (1270, 1170).
| 时间上限 | 内存上限 |
| 1000 | 10000 |