不喜勿喷不喜勿喷 不喜勿喷不喜勿喷

#include<bits/stdc++.h>
using namespace std;
int arr[101][101]={};
int vis[101][101]={};
int n,m;
int x=0;
int zb[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
int main(){
    cin>>n;
    m=n*n;
    int sx=n-1,sy=0;
    for(int i=0;i<m;i++){
        arr[sx][sy]=i+1;
        vis[sx][sy]=1;
        //cout<<arr[sx][sy]<<" "<<sx<<" "<<sy<<endl;
        sx+=zb[x%4][0];
        sy+=zb[x%4][1];
        if(sx>=n||sy>=n||sx<0||sy<0||vis[sx][sy]==1){
        	x++;
        	sx-=zb[(x-1)%4][0];
        	sx+=zb[x%4][0];
        	sy-=zb[(x-1)%4][1];
        	sy+=zb[x%4][1];
		}
    }
    int q,w,e;
    srand(m);
    q=rand();
    srand(n);
    w=rand();
    srand(x);
    e=rand();
    system("title");
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        	char a1[101]={},a2[101]={},a3[101]={},b1[101]={},b2[101]={},b3[101]={};
        	int sj1,sj2,sj3;
        	srand(i+j);
        	sj1=rand();
        	srand(i*j+i+rand());
        	sj2=rand();
        	srand(e*w*q*x);
        	sj3=rand();
        	q=abs(q-sj1)%255;
        	w=abs(w-sj2)%255;
        	e=abs(e-sj3)%255;
        	itoa(q,a1,10);
        	itoa(w,a2,10);
        	itoa(e,a3,10); 
        	int fq=255-q,fw=255-w,fe=255-e;
        	itoa(fq,b1,10);
        	itoa(fw,b2,10);
        	itoa(fe,b3,10);
        	cout<<"\033[48;2;"<<a1<<";"<<a2<<";"<<a3<<"m";
        	cout<<"\033[38;2;"<<b1<<";"<<b2<<";"<<b3<<"m"; 
            printf("%5d",arr[j][i]);
        }
        cout<<endl;
        for(int j=0;j<n;j++){
        	char a1[101]={},a2[101]={},a3[101]={},b1[101]={},b2[101]={},b3[101]={};
        	int sj1,sj2,sj3;
        	srand(i+j);
        	sj1=rand();
        	srand(i*j+i+rand());
        	sj2=rand();
        	srand(e*w*q*x);
        	sj3=rand();
        	q=abs(q-sj1)%255;
        	w=abs(w-sj2)%255;
        	e=abs(e-sj3)%255;
        	itoa(q,a1,10);
        	itoa(w,a2,10);
        	itoa(e,a3,10); 
        	int fq=255-q,fw=255-w,fe=255-e;
        	itoa(fq,b1,10);
        	itoa(fw,b2,10);
        	itoa(fe,b3,10);
        	cout<<"\033[48;2;"<<a1<<";"<<a2<<";"<<a3<<"m";
        	cout<<"\033[38;2;"<<b1<<";"<<b2<<";"<<b3<<"m"; 
        	cout<<"     ";
		}
		cout<<endl;
    }
    cout<<"\033[48;2;0;0;0m\033[38;2;255;255;255m";
    return 0;
}