- xxyw1-5螺旋矩阵
- @ 2023-07-19 17:30:06
//这题很简单,字符串加模拟
//伪代码:
int n m t i j
ch a[][]
str st
    输入:n m st
    i <- j <- 1
    a[1][1] <- st[0];
    t<n*m-1 then do //模拟法造螺旋方阵
        j+1<=m and not a[i][j+1] then do a[i][++j]<-st[++t];
        i+1<=n and not a[i+1][j] then do a[++i][j]<-st[++t];
        j-1>=1 and not a[i][j-1] then do a[i][--j]<-st[++t];
        not a[i-1][j] then do a[--i][j]<-st[++t];
    输出一行,不加空格
2 条评论
- 
  240803gj徐嘉昊 (2212224徐嘉昊) LV 10 @ 2023-07-20 18:53:53cout<<"代码仅供参考"<<endl; cout<<"抄题解的死全家"<<endl;
- 
  @ 2023-07-20 10:55:09防抄题解对吧 
- 1
信息
- ID
- 1316
- 难度
- 9
- 分类
- (无)
- 标签
- 递交数
- 7
- 已通过
- 5
- 通过率
- 71%
- 上传者