Untitled

 avatar
unknown
plain_text
17 days ago
1.8 kB
4
Indexable
import java.io.BufferedReader;
import java.io.IOException;
import java.util.*;
import java.io.InputStreamReader;
 
public class Main {
    
 
    public static void main (String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s1 = br.readLine().split(" ");
        int t = Integer.parseInt(s1[0]);
        
        
        while(t-- > 0){
            s1 = br.readLine().split(" ");
            int n = Integer.parseInt(s1[0]);
            
            
            
            char[][] ans = new char[2*n][2*n];
            
            boolean flag = true; // true -> * and false -> -
            
            for(int i = 0;i< 2*n;i+=2){ //row wise
                for(int j = 0;j< 2*n ;j+=2){
                    if(flag){
                        for(int row = 0;row<2;row++){
                            for(int col = 0;col<2;col++){
                                ans[i+row][j+col] = '*';
                            }
                        }
                        flag = false;
                    }
                    else{
                        for(int row = 0;row<2;row++){
                            for(int col = 0;col<2;col++){
                                ans[i+row][j+col] = '-';
                            }
                        }
                        flag = true;
                    }
                }
                if(n % 2 == 0)
                    flag = !flag;
            }
            
            
            for(int i = 0;i<2*n;i++){
                for(int j = 0;j<2*n;j++){
                    System.out.print(ans[i][j]);
                }
                System.out.println();
            }
            
            

        }
        
        
    }
    
    
    
    
}
Leave a Comment