728x90
출처-https://www.acmicpc.net/problem/2446
728x90
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan=new Scanner(System.in);
int N=scan.nextInt();
for (int i=1;i<=N;i++) {
for (int j=1;j<=i-1;j++)
System.out.print(" ");
for (int j=1;j<=2*(N-i+1)-1;j++)
System.out.print("*");
System.out.println();
}
for (int i=1;i<N;i++) {
for (int j=N-i-1;j>=1;j--)
System.out.print(" ");
for (int j=1;j<=2*i+1;j++)
System.out.print("*");
System.out.println();
}
}
}
728x90
'Problem Solving > BOJ' 카테고리의 다른 글
[백준, BOJ 10992] 별 찍기 - 17 (java) (0) | 2020.08.14 |
---|---|
[백준, BOJ 10991] 별 찍기 - 16 (java) (0) | 2020.08.14 |
[백준, BOJ 2522] 별 찍기 - 12 (java) (0) | 2020.08.13 |
[백준, BOJ 2445] 별 찍기 - 8 (java) (0) | 2020.08.13 |
[백준, BOJ 2442] 별 찍기 - 5 (java) (0) | 2020.08.13 |