-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ2442.java
More file actions
29 lines (27 loc) · 961 Bytes
/
Q2442.java
File metadata and controls
29 lines (27 loc) · 961 Bytes
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
/**
* Date: 2018. 9. 10.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/skhucode/skhucode-inhyuck
* Title: 별찍기 - 5
* Problem: 첫째 줄에는 별 1개, 둘째 줄에는 별 3개, ..., N번째 줄에는 별 2*N-1개를 찍는 문제
* 별은 가운데를 기준으로 대칭이어야 한다.
* URL: https://www.acmicpc.net/problem/2442
*/
package io.inhyuck.io;
import java.util.Scanner;
public class Q2442 {
public static void main(String[] args) {
int n = new Scanner(System.in).nextInt();
for (int i = 1; i <= n; i++) {
int startCount = 2 * i - 1;
int leftSpaceCount = (2 * n - 1 - startCount) / 2;
for (int j = 0; j < leftSpaceCount; j++) {
System.out.print(" ");
}
for (int j = 0; j < startCount; j++) {
System.out.print("*");
}
System.out.println();
}
}
}