-
Notifications
You must be signed in to change notification settings - Fork 0
/
10996_별 찍기 - 21.java
36 lines (35 loc) · 1.07 KB
/
10996_별 찍기 - 21.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
if(n==1){
bw.write("*\n");
} else{
for(int i=0;i<2*n;i++){
if(i%2==1){
for(int j=0;j<n;j++){
if(j%2==1){
bw.write("*");
} else{
bw.write(" ");
}
}
} else {
for(int j=0;j<n;j++){
if(j%2==1){
bw.write(" ");
} else{
bw.write("*");
}
}
}
bw.write("\n");
}
}
bw.flush();
bw.close();
}
}