编程题

#include using namespace std;int main() {\tint n, m;\tcin >> n >> m;\tint x = 1;\tint y = 1;\tint dx = 1;\tint dy = 1;\tint cnt = 0;\twhile (cnt != 2) {\t\tcnt = 0;\t\tx = x   dx;\t\ty = y   dy;\t\tif (x == 1 || x == n) {\t\t\t  cnt;\t\t\tdx = -dx;\t\t}\t\tif (y == 1 || y == m) {\t\t\t  cnt;\t\t\tdy = -dy;\t\t}\t}\tcout << x << " " << y << endl;\treturn 0;}

输入1:4 3

输出1:_________(2 分)

输入2:2017 1014

输出 2:_________(3 分)

输入3:987 321

输出3:_________(3 分)

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论