a417. 螺旋矩陣 (題目連結) 解題思路 :::info 1.填表 用二維陣列儲存資料,由左上角開始填數字,接下來四個 while 分別表示 : 向右、向下、向左、向上,當 i 或 j 超出範圍或目標格已經有值時,跳出迴圈。一直重複直到全部填完。 2.翻轉 若 m==2 將 matrix[i][j] 和matrix[j][i] 全部交換。
1/29/2023花中judge d001. Jumping Array Puzzle (題目連結) BFS作法 AC (90ms, 8.4MB) #include <bits/stdc++.h> using namespace std; #define int long long #define x first
7/25/2022f315. 低地距離 (題目連結) BFS做法 AC (0.7s, 12MB) #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 5;
7/25/2022d539. 區間 MAX (題目連結) 線段樹做法 AC (0.3s, 12.1MB) #include <bits/stdc++.h> #define int long long using namespace std; const int N = 5e5 + 5;
7/20/2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up