首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
uly
2026年3月3日 15:21
旋转方阵 题解:
P1216
回复 0
|
赞 23
|
浏览 383
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int mat[20][20] = {0}; int top = 0, bottom = n - 1, left = 0, right = n - 1; int num = 1; while (num <= n ...
南烛
2026年3月2日 09:44
旋转方阵 题解:喜欢我的古法最麻烦的解法吗
P1216
回复 0
|
赞 7
|
浏览 320
#include<stdio.h> #include<string.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ int a[n][n]; memset(a,0,sizeof(a));  ...
南烛
2026年3月2日 09:44
旋转方阵 题解:喜欢我的古法最麻烦的解法吗
P1216
回复 0
|
赞 2
|
浏览 156
#include<stdio.h> #include<string.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ int a[n][n]; memset(a,0,sizeof(a));  ...
mlx
2026年2月4日 22:55
旋转方阵 题解:
P1216
回复 0
|
赞 7
|
浏览 323
#include<iostream> #include<cstring> using namespace std; const int N=22; int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0}; int n,k; int path[N][N]; int a[N][N]; void get(int &x,int &y,int way) { if(way==0) x++; else if(way==1) y++; else if(way==2) x--; ...
xsw
2026年2月1日 11:12
旋转方阵 题解:
P1216
回复 0
|
赞 5
|
浏览 329
#include<iostream> #include<cstdio> using namespace std; int s[25][25]; int main() { int n; cin >> n; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dir = 0; for (int x = 0, y = 0, k = 1; k <= n * n; k ++ ) { s[x][y] = k; x += dx[dir], y ...
ljh61
2026年1月29日 10:58
旋转方阵 题解:
P1216
回复 0
|
赞 4
|
浏览 239
#include <bits/stdc++.h> using namespace std; int main(){ int n; int DIRS[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};//下右上左 while(cin>>n){ vector<vector<int>> a(n,vector<...
kawhileo
2026年1月27日 23:47
旋转方阵 题解:
P1216
回复 0
|
赞 4
|
浏览 259
#include<bits/stdc++.h> using namespace std; int main(){ //构造二维数组 int n; scanf("%d",&n); if(n<1||n>20) return 0; if(n==1){ printf("1"); &n...
曾不会
2026年1月25日 21:02
旋转方阵 题解:左对齐使用%-3d就可以啦
P1216
回复 0
|
赞 13
|
浏览 376
左对齐使用%-3d就可以啦 #include<stdio.h> int main() { int n; scanf("%d",&n); int a[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) &...
滴滴答答302
2026年1月12日 10:43
旋转方阵 题解:
P1216
回复 0
|
赞 28
|
浏览 539
思路:按照左列 下行 右列 上行的循序依次赋值,这里我们4个4个赋值,就刚好不重叠的铺满一围(其他n时候同理最外围每次赋值n-1). int n = 0;//输入的整数n int count=1;//赋值的数,从1开始++到n*n int a[21][21]={0};//二维数组来模拟矩阵 scanf("%d",&n); for(int i=0;i<(n+1)/2;i++)//总的层数 { &nbs...
SpontySoul
2026年1月9日 16:43
旋转方阵 题解:
P1216
回复 0
|
赞 8
|
浏览 333
#include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int a[21][21] = {0}; int top = 1, bottom = n, left = 1, right = n; int val = 1; while (top <= bottom && left <= right) { // 从上到下填充当前最左列 ...
1
2
3
4
5
题目
旋转方阵
题解数量
48
发布题解
在线答疑
热门题解
1
旋转方阵 题解:
2
旋转方阵 题解:
3
旋转方阵(模拟) 题解:
4
旋转方阵 题解:C++ 需要注意结果的输出格式
5
旋转方阵 题解:
6
旋转方阵 题解:
7
旋转方阵 题解:
8
旋转方阵 题解:
9
c 解法:
10
旋转方阵 题解:方块收缩模拟输出