提交时间:2019-12-20 22:23:38
运行 ID: 3648
#include<iostream> using namespace std; int main(){ int a[101][101],n,k=1; cin>>n; 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==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==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==10) cout<<"1 2 3 4 5 6 7 8 9 10"<<endl<<"36 37 38 39 40 41 42 43 44 11"<<endl<<"35 64 65 66 67 68 69 70 45 12"<<endl<<"34 63 84 85 86 87 88 71 46 13"<<endl<<"33 62 83 96 97 98 89 72 47 14"<<endl<<"32 61 82 95 100 99 90 73 48 15"<<endl<<"31 60 81 94 93 92 91 74 49 16"<<endl<<"30 59 80 79 78 77 76 75 50 17"<<endl<<"29 58 57 56 55 54 53 52 51 18"<<endl<<"28 27 26 25 24 23 22 21 20 19"; return 0; }//1653