1 条题解

  • 2
    @ 2023-3-11 16:35:45
    #include<bits/stdc++.h>
    using namespace std;
    //输入保证正确
    //输出看仔细
    //所有情况都测
    //数组定义,保证正确
    char a [ 15 ] [ 15 ] , b [ 15 ] [ 15 ] , c [ 15 ] [ 15 ] ;
    bool check ( int n )
    {
    	for ( int i = 1 ; i <= n; i ++ )
    	{
    		for ( int j = 1 ; j <= n ; j ++ )
    		{
    			if( b [ i ] [ j ] != c [ i ] [ j ] )
    			{
    				return false ;
    			}
    		}
    	}
    	return true ;
    }
    void jsd ( int n )
    {
    	char d [ 15 ] [ 15 ] ;
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1 ; j <= n ; j ++ )
    		{
    			d [ i ] [ j ] = b [ i ] [ j ] ;
    		}
    	}
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1 ; j <= n ; j ++ )
    		{
    			b [ j ] [ i ] = d [ n + 1 -i ] [ j ] ;
    		}
    	}
    }
    void jx ( int n )
    {
    	char d [ 15 ] [ 15 ] ;
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1 ; j <= n ; j ++ )
    		{
    			d [ i ] [ j ] = b [ i ] [ j ] ;
    		}
    	}
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1 ; j <= n ; j ++ )
    		{
    			b [ i ] [ j ] = d [ i ] [ n + 1 - j ] ;
    		}
    	}
    }  
    int main()
    {
    	int n ;
    	cin >> n ;
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1; j <= n ; j ++ )
    		{
    			 cin >> a [ i ] [ j ] ;
    			 b [ i ] [ j ] = a [ i ] [ j ] ; 
    		}	
    	}
    	for( int i = 1 ; i <= n ; i ++ )
    	{
    		for( int j = 1; j <= n ; j ++ )
    			cin >> c [ i ] [ j ] ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 1 << endl ;
    		return 0 ;
    	}	
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 2 << endl ;
    		return 0 ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 3 << endl ;
    		return 0 ;
    	}
    	jsd ( n ) ;
    	jx ( n ) ;
    	if( check ( n ) == true ) 
    	{
    		cout<< 4 << endl ;	
    		return 0 ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true ) // zu
    	{
    		cout<< 5 << endl ;
    		return 0 ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 5 << endl ;
    		return 0 ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 5 << endl ;
    		return 0 ;
    	}
    	jsd ( n ) ;
    	if( check ( n ) == true )
    	{
    		cout<< 6 << endl ;
    		return 0 ;
    	}
    	else
    	{
    		cout << 7 << endl ;
    		return 0 ;
    	}	
     	return 0;
    }
    
    

    信息

    ID
    225
    时间
    1000ms
    内存
    64MiB
    难度
    2
    标签
    递交数
    28
    已通过
    18
    上传者