This repository was archived by the owner on May 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP5731.cpp
More file actions
40 lines (39 loc) · 1.96 KB
/
P5731.cpp
File metadata and controls
40 lines (39 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// Created by RenAhsAcme on 2026/4/17.
//
#include <iostream>
using namespace std;
int main() {
int n = 0;
cin >> n;
if (n == 1)
cout << " 1";
if (n == 2)
cout << " 1 2" << endl << " 4 3";
if (n == 3)
cout << " 1 2 3" << endl << " 8 9 4" << endl << " 7 6 5";
if (n == 4)
cout << " 1 2 3 4" << endl << " 12 13 14 5" << endl << " 11 16 15 6" << endl << " 10 9 8 7";
if (n == 5)
cout << " 1 2 3 4 5" << endl << " 16 17 18 19 6" << endl << " 15 24 25 20 7" << endl << " 14 23 22 21 8"
<< endl << " 13 12 11 10 9";
if (n == 6)
cout << " 1 2 3 4 5 6" << endl << " 20 21 22 23 24 7" << endl << " 19 32 33 34 25 8" << endl
<< " 18 31 36 35 26 9" << endl << " 17 30 29 28 27 10" << endl << " 16 15 14 13 12 11";
if (n == 7)
cout << " 1 2 3 4 5 6 7" << endl << " 24 25 26 27 28 29 8" << endl << " 23 40 41 42 43 30 9" << endl
<< " 22 39 48 49 44 31 10" << endl << " 21 38 47 46 45 32 11" << endl << " 20 37 36 35 34 33 12" << endl
<< " 19 18 17 16 15 14 13";
if (n == 8)
cout << " 1 2 3 4 5 6 7 8" << endl << " 28 29 30 31 32 33 34 9" << endl
<< " 27 48 49 50 51 52 35 10" << endl << " 26 47 60 61 62 53 36 11" << endl
<< " 25 46 59 64 63 54 37 12" << endl << " 24 45 58 57 56 55 38 13" << endl
<< " 23 44 43 42 41 40 39 14" << endl << " 22 21 20 19 18 17 16 15";
if (n == 9)
cout << " 1 2 3 4 5 6 7 8 9" << endl << " 32 33 34 35 36 37 38 39 10" << endl
<< " 31 56 57 58 59 60 61 40 11" << endl << " 30 55 72 73 74 75 62 41 12" << endl
<< " 29 54 71 80 81 76 63 42 13" << endl << " 28 53 70 79 78 77 64 43 14" << endl
<< " 27 52 69 68 67 66 65 44 15" << endl << " 26 51 50 49 48 47 46 45 16" << endl
<< " 25 24 23 22 21 20 19 18 17";
return 0;
}