太长了写不下 我把主要部分贴出来 cin >> h >> l >> speedl >> speedh; while (true) { screen = draw(background, chara, h-1, l-1); //在背景图指定位置画个角色 int diff = different(screen, lastscreen); //和上一张图区别多少字符 lastscreen = screen; h += speedh; l += speedl; sum += diff; if (h > H && speedh >= 0) break; //这段好像可以写在开始 无所谓了 if (l > W && speedl >= 0) break; if (h + pH < 2 && speedh <= 0) break; if (l + pW < 2 && speedl <= 0) break; } sum += different(background, screen);
点赞 2
牛客网
牛客企业服务