public class Main01 {     public static void main(String[] args) {         Scanner sc = new Scanner(System.in);         int n = sc.nextInt();         int m = sc.nextInt();         char[][] c = new char[n][m];         for(int i = 0;i<n;i++) {             for(int j = 0;j<m;j++) {                 c[i][j] = sc.next().charAt(0);             }         }         for(int j = 0;j<m;j++) {             int hasX = 0;             int count = 0;             for(int i = n-1;i >= 0;i--) {                 if(hasX == 0) {                     if(c[i][j] == 'o') {                         c[i][j] = '.';                     }                 }                 if(c[i][j] == 'x') {                     hasX = i;                     count = 0;                 }                               if(hasX != 0) {                      if(c[i][j] == 'o') {                         c[i][j] = '.';                         count += 1;                         c[hasX-count][j] = 'o';                     }                 }             }         }                  for(int i = 0;i<n;i++) {             for(int j = 0;j<m;j++) {                 System.out.print(c[i][j]+" ");             }             System.out.println();         }              } }
点赞 评论

相关推荐

码农索隆:谁问你了 举报了 删了,求你了 我要哭了 我一点也不眼红 我要跳楼
点赞 评论 收藏
分享
09-09 16:12
已编辑
成都理工大学 Java
future0210:学java就是好啊,啥都能转
点赞 评论 收藏
分享
今天要投简历吗?&nbsp;国庆期间真的不投比较好吗?&nbsp;emmmmmm
想要offer的每一...:可以去投,谁回你,你就拉黑他,国庆还上班,贼黑心
我的秋招日记
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务