当前位置:网站首页>Acwing Brush Questions Section 1
Acwing Brush Questions Section 1
2022-07-30 07:24:00 【A positive little salted fish】
756
Topic Analysis:
The key points are as follows:
1. Matrix traversal: determine the traversal direction
2. Determine the traversal boundary
#include #include #include using namespace std;const int N = 110;int n,m;int res[N][N];int main(){cin>>n>>m;int dx[] = {0,1,0,-1};int dy[] = {1,0,-1,0};for(int x = 0,y = 0 ,k = 1,d = 0;k<=n*m;k++){res[x][y] = k;int a = x+dx[d],b = y + dy[d];if(a<0 || a>=n ||b<0||b>=m||res[a][b]){d = (d+1)%4;a = x + dx[d], b = y + dy[d];}x = a,y = b;}for(int i = 0;i
边栏推荐
猜你喜欢
随机推荐
QT serial 4: LORA test platform based on QT and STM32H750 (3)
js 替换字符串中所有 “ 引号 —— 数据处理
HSPF model application
干货 | 什么是FOC?一文带你看BLDC电机驱动芯片及解决方案
Sklearn : train_test_split()函数的用法
QT连载3:基于QT和STM32H750的LORA试验平台(2)
高集成度 MCU 市场增大,如何加速 BLDC 领域落地应用
租用服务器训练yolov3模型
Written before the official account - QT, ARM, DSP, microcontroller, power electronics and transmission!
创建快捷方式时如何不带“快捷方式“后缀字样?
昆仑通态屏幕制作(连载5)---基础篇(串口接收,文本与灯显示)
删除当前路径下含某个关键字的所有文件
IEEE在指定期刊下搜索相关论文
Anaconda 安装低版本tensorflow
i++与 ++i 的区别
[Jiangsu University of Science and Technology Automation Association stm32F103c8t6] Notes [Initial 32 MCU and TIM timing interrupt initialization parameter configuration]
ipconfig Command Guide
爬2.12.6的Antd上传图片坑
Insertion Sort in Classic Sort
xftp的简单使用