//和蛇形填数是同一种类型的题目,要进行预判断! #include <iostream> using namespace std; char map[10000][10000]; int main() { int i, j, m, n, tot; char ch = 'A'; cin >> m >> n; for(i = 0; i < m; i++) for (j = 0; j < n; j++) map[i][j] = '0'; i = j = tot = 0; map[i][j] = 'A'; while (tot < n*m-1){//注意这里的判断! while (j+1 < n && map[i][j+1] == '0'){ if (ch >= 90) ch -= 26; j = j + 1; ch = ch + 1; map[i][j] = ch; tot = tot + 1; } while (i+1 < m && map[i+1][j] == '0'){ if (ch >= 90) ch -= 26;
poj 3752 字母旋转游戏
最新推荐文章于 2020-09-19 22:11:27 发布