- 方阵填数
咋做
- 2023-10-22 19:59:24 @
怎么旋转输出啊?😕
5 comments
-
马熠涵 LV 6 @ 2023-10-29 19:25:32
这么做
-
2023-10-29 19:25:12@
#include<bits/stdc++.h> using namespace std; int a[40][40]; int main(){ int n,c,r=1,ans=1; cin>>n; c=n; a[r][c]=ans++; while(ans<=n*n){ while(r<n&&!a[r+1][c]) a[++r][c]=ans++; while(c>1&&!a[r][c-1]) a[r][--c]=ans++; while(r>1&&!a[r-1][c]) a[--r][c]=ans++; while(c<n&&!a[r][c+1]) a[r][++c]=ans++; } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ printf("%2d ",a[i][j]); } cout<<endl; } return 0; }
-
2023-10-23 20:26:47@
首先拿出电脑,把电脑旋转,就可以了
-
2023-10-22 20:00:35@
😕 😕 😕
-
2023-10-22 20:00:07@
不会
🤣 2
- 1
Information
- ID
- 1211
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 109
- Accepted
- 19
- Uploaded By