题解
2023-09-07 21:21:08
发布于:四川
24阅读
0回复
0点赞
扔一个打表上来,洛谷是可以过的,ACGO没开SPJ,真的好拉,过不了。
代码(别抄
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
if (n==1 || n==3){
cout<<"NO\n";
return 0;
}
vector<vector<vector<int>>> ans={{},{},{{1,2},{4,3}},{},{{1,2,11,12},{4,9,8,5},{7,10,3,14},{6,13,16,15}},{{1,2,3,4,7},{6,5,14,15,16},{13,24,23,8,21},{10,19,18,11,20},{9,22,25,12,17}},{{1,2,3,8,9,4},{6,11,20,33,28,25},{5,36,23,14,15,22},{12,31,30,17,26,21},{7,16,13,24,35,32},{10,27,34,19,18,29}},{{1,2,3,4,7,6,5},{12,17,14,15,16,25,18},{11,20,33,46,37,42,41},{8,21,40,43,36,47,32},{9,22,49,24,35,26,27},{10,19,48,23,38,45,34},{13,28,31,30,29,44,39}},{{1,2,3,4,7,6,5,14},{12,17,20,27,34,25,18,23},{11,26,21,32,39,28,61,36},{8,15,46,51,58,31,48,35},{9,22,57,52,55,42,41,62},{10,19,40,49,54,47,56,45},{13,24,43,60,53,50,33,64},{16,37,30,29,44,59,38,63}},{{1,2,3,4,7,6,5,8,9},{10,21,20,27,34,25,18,23,38},{13,40,33,26,45,28,19,24,35},{16,31,76,81,68,69,70,79,72},{15,22,51,56,71,80,57,52,37},{14,39,62,41,60,47,32,75,64},{17,44,65,48,49,54,77,74,63},{12,29,42,55,58,73,36,53,50},{11,30,67,46,43,66,61,78,59}},{{1,2,3,4,7,6,5,8,9,10},{12,29,38,33,34,25,36,23,44,27},{11,30,59,68,45,28,43,24,35,26},{18,41,42,71,56,75,64,37,66,47},{13,48,19,60,53,98,93,100,91,90},{16,31,40,97,54,83,74,99,82,67},{15,22,49,52,55,96,77,80,57,46},{14,39,58,79,72,95,62,87,70,61},{17,50,51,88,85,78,89,92,81,76},{20,21,32,69,94,73,84,65,86,63}}};
for (int i=0;i<n;++i){
for (int j=0;j<n;++j){
cout<<ans[n][i][j]<<" ";
}
cout<<endl;
}
return 0;
}
这里空空如也
有帮助,赞一个