首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
苍灵
2025年6月26日 19:49
旋转方阵 题解:C++ 需要注意结果的输出格式
P1216
回复 0
|
赞 2
|
浏览 108
#include<bits/stdc++.h> using namespace std; int main(){ int n,index=1,a[30][30]={0}; cin>>n; int left=0,right=n-1,top=0,bottom=n-1; while(top<=bottom&&left<=right){ //从上到下 for(int i=top;i<=bottom;i++){ a[i][left]=index; index++; } le...
quyang
2025年3月13日 20:37
旋转方阵 题解:eee
P1216
回复 0
|
赞 10
|
浏览 665
#include<iostream> using namespace std; #include<iomanip> int main(){ int n; cin>>n; int sx=0,sy=0,loop=n/2; int offset=1; int a[20][20]={0}; int cnt=1; &n...
zxjrheaven
2025年3月12日 20:45
旋转方阵 题解:暴力循环搜索
P1216
回复 0
|
赞 5
|
浏览 586
#include <bits/stdc++.h> using namespace std; int dir[4][2]={1,0,0,1,-1,0,0,-1}; int main() { int n; cin>>n; int num[n][n]; int vis[n][n]; memset(num,0,sizeof(num)); &nbs...
jaygee_
2025年3月1日 13:40
旋转方阵 题解:
P1216
回复 3
|
赞 55
|
浏览 1.2k
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; // 输入方阵的大小 vector<vector<int>> matrix(n, vector<int>(n)); // 定义 n*n 的矩阵,n代表行数,vector<int>(n)代表列数 int num = 1; // 当前填充的数字 int left = 0, right = n - 1, top = 0, botto...
RingoCrystal
2025年1月27日 13:07
旋转方阵 题解:方块收缩模拟输出
P1216
回复 0
|
赞 17
|
浏览 864
#include <bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n){ vector<vector<int>> a(n,vector<int>(n)); int k=1,r=n; for(int r=n;r>=0;r--){ for(int i=n-r;i<r;i++)a[i][n-r]=k++; ...
Candour
2024年5月18日 23:37
旋转方阵(模拟) 题解:
P1216
回复 0
|
赞 37
|
浏览 1.6k
#include<bits/stdc++.h> using namespace std; const int N = 110; int n, cnt = 1; int res[N][N]; int main() { cin >> n; int top = 1,bottom = n,left = 1,right = n; int cnt = 1; while(1) { for(int i = top; i <= bottom; i ++) res[i][left] = cnt ...
122793160
2024年3月19日 19:43
旋转方阵 题解:
P1216
回复 0
|
赞 3
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n][n]; a[0][0]=1; int b[n][n]; fill(b[0],b[0]+n*n,0); b[0][0]=1; ...
Cookie‘s AE86
2024年3月18日 19:14
旋转方阵 题解:搜索的思想实现,注意输出格式不是\t
P1216
回复 0
|
赞 7
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; int main(){ int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1}; //下右上左 int n; cin >> n; int ans[n+2][n+2]; int visit[n+2][n+2]; memset(visit, 0, sizeof(visit)); for(int i = 0; i < n+2; i++){ ...
Śś
2024年3月18日 10:42
旋转方阵 题解:
P1216
回复 0
|
赞 5
|
浏览 1.0k
//画图,按照路线编写代码 #include<iostream> using namespace std; int A[21][21]; void F(int n) { int k = n-1; int count = 0; int a=0,b=1;//标记行列 while(k>0)//↓→↑← 循环往复  ...
OIsay-good
2024年3月16日 21:24
旋转方阵 题解:
P1216
回复 0
|
赞 18
|
浏览 1.5k
核心就是转圈圈,不能多也不能少,草稿纸上多画画 #include <stdio.h> int s[25][25]; int main(){ int n; scanf("%d",&n); int count=1; for (int i = 0; i < n/2; i++)//总循环(5->转两圈,6->转3圈) { &nb...
1
2
3
题目
旋转方阵
题解数量
27
发布题解
在线答疑
热门题解
1
旋转方阵 题解:
2
旋转方阵(模拟) 题解:
3
旋转方阵 题解:
4
旋转方阵 题解:方块收缩模拟输出
5
c 解法:
6
旋转方阵 题解:eee
7
找规律啊,找规律
8
无题.
9
旋转方阵 题解:搜索的思想实现,注意输出格式不是\t
10
旋转方阵 题解:就一个图,自己悟吧!