要暴力枚举了嘤嘤嘤

P5731 【深基5.习6】蛇形方阵

你想表达什么?
by Fractured_Angel @ 2024-10-06 20:04:50


其他方法不会
by zzh18978062190 @ 2024-10-06 20:08:07


@[zzh18978062190](/user/1430978) 暴力怎么写
by cccckick @ 2024-10-14 19:28:08


@[cccckick](/user/1449927) 枚举9个,直接输出
by goodsnack @ 2024-10-21 21:23:24


@[goodsnack](/user/1348393) 暴力输出叫打表
by zhongjohn @ 2024-10-26 15:27:58


```cpp #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; if(n==1){ cout<<" 1"; } if(n==3){ cout<<" 1 2 3"<<endl; cout<<" 8 9 4"<<endl; cout<<" 7 6 5"; } if(n==5){ cout<<" 1 2 3 4 5"<<endl; cout<<" 16 17 18 19 6"<<endl; cout<<" 15 24 25 20 7"<<endl; cout<<" 14 23 22 21 8"<<endl; cout<<" 13 12 11 10 9"; } if(n==8){ cout<<" 1 2 3 4 5 6 7 8"<<endl; cout<<" 28 29 30 31 32 33 34 9"<<endl; cout<<" 27 48 49 50 51 52 35 10"<<endl; cout<<" 26 47 60 61 62 53 36 11"<<endl; cout<<" 25 46 59 64 63 54 37 12"<<endl; cout<<" 24 45 58 57 56 55 38 13"<<endl; cout<<" 23 44 43 42 41 40 39 14"<<endl; cout<<" 22 21 20 19 18 17 16 15"; } if(n==9){ cout<<" 1 2 3 4 5 6 7 8 9"<<endl; cout<<" 32 33 34 35 36 37 38 39 10"<<endl; cout<<" 31 56 57 58 59 60 61 40 11"<<endl; cout<<" 30 55 72 73 74 75 62 41 12"<<endl; cout<<" 29 54 71 80 81 76 63 42 13"<<endl; cout<<" 28 53 70 79 78 77 64 43 14"<<endl; cout<<" 27 52 69 68 67 66 65 44 15"<<endl; cout<<" 26 51 50 49 48 47 46 45 16"<<endl; cout<<" 25 24 23 22 21 20 19 18 17"; } return 0; } ``` 打表程序
by zhongjohn @ 2024-10-26 15:44:54


|