📄 1219.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 1219 on 2006-01-09 at 22:47:43 */
#include <cstdio>
int main()
{
int x, y, dx, dy, n, s;
while(scanf("%d %d %d %d %d", &s, &x, &y, &dx, &dy) != EOF && dx != 0) {
int ox = x % s, oy = y % s, rn = 0;
for(n = 0; true; n++) {
if(x%s != 0 && y%s != 0 && (x/s+y/s)%2 == 1) {
printf("After %d jumps the flea lands at (%d, %d).\n", n, x, y);
break;
}
x += dx, y += dy;
if(x%s == ox && y%s == oy) {
if(++rn == 2) {
printf("The flea cannot escape from black squares.\n");
break;
}
}
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -