fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int rt = sc.nextInt();
  7. while (rt>0) {
  8. int rn = sc.nextInt();
  9. for (int i=0;i<2*rn;i++){
  10. for (int j=0;j<rn;j++){
  11. if((i / 2 + j) % 2 != 0){
  12. System.out.print("..");
  13. } else {
  14. System.out.print("##");
  15. }
  16. }
  17. System.out.println();
  18. }
  19. rt--;
  20. }
  21. }
  22. }
Success #stdin #stdout 0.18s 56604KB
stdin
4
1
2
3
4
stdout
##
##
##..
##..
..##
..##
##..##
##..##
..##..
..##..
##..##
##..##
##..##..
##..##..
..##..##
..##..##
##..##..
##..##..
..##..##
..##..##