您的位置:首页 > 娱乐 > 明星 > 网络科技公司logo_免费ppt模板app有哪些_网站seo查询_网络营销管理

网络科技公司logo_免费ppt模板app有哪些_网站seo查询_网络营销管理

2025/4/11 0:02:02 来源:https://blog.csdn.net/2402_88149600/article/details/146716986  浏览:    关键词:网络科技公司logo_免费ppt模板app有哪些_网站seo查询_网络营销管理
网络科技公司logo_免费ppt模板app有哪些_网站seo查询_网络营销管理

59. 螺旋矩阵 II - 力扣(LeetCode)

代码区:

class Solution {const int MAX=25;
public:vector<vector<int>> generateMatrix(int n) {vector<vector<int>> ans;vector<int> hang;int len_n=n;int arry[25][25];int start_hang=0,start_lie=0,end_hang=len_n-1,end_lie=len_n-1;int step=1;while(step<=n*n){for(int i=start_lie;i<=end_lie;i++){//行不变列增加arry[start_hang][i]=step;step++;}start_hang++;for(int i=start_hang;i<=end_hang;i++ ){//列不变行增加arry[i][end_lie]=step;step++;}end_lie--;for(int i=end_lie;i>=start_lie;i--){//行不变,列减小arry[end_hang][i]=step;step++;}end_hang--;for(int i=end_hang;i>=start_hang;i-- ){//列不变,行减小arry[i][start_lie]=step;step++;}start_lie++;}for(int i=0;i<len_n;i++){for(int j=0;j<len_n;j++){hang.push_back(arry[i][j]);}ans.push_back(hang);hang.clear();}return ans;}
};

欢迎各位读者提出意见。

(菜菜奋斗小日记)

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com