-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q2443.java
30 lines (27 loc) · 957 Bytes
/
Q2443.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
/**
* Date: 03/11/2018
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/inhyuck/problem-solving
* Title: 별찍기 - 6
* description: 첫째 줄에는 별 2*N-1개, 둘째 줄에는 별 2*N-3개, ..., N번째 줄에는 별 1개를 찍는 문제
* Solution Key: -
* Problem URL: https://www.acmicpc.net/problem/2443
*/
package io.inhyuck.basic;
import java.util.Scanner;
public class Q2443 {
public static void main(String[] args) {
int n = new Scanner(System.in).nextInt();
StringBuilder resultBuilder = new StringBuilder();
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
resultBuilder.append(" ");
}
for (int j = 0; j < (2 * n - 1) - (2 * i); j++) {
resultBuilder.append("*");
}
resultBuilder.append("\n");
}
System.out.println(resultBuilder.toString());
}
}