Skip to content

Commit 4c64141

Browse files
committed
[level 0] Title: 직각삼각형 출력하기, Time: 183.83 ms, Memory: 74.7 MB -BaekjoonHub
1 parent fcf07ed commit 4c64141

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# [level 0] 직각삼각형 출력하기 - 120823
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120823)
4+
5+
### 성능 요약
6+
7+
메모리: 74.7 MB, 시간: 183.83 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩테스트 입문
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 04월 18일 11:20:55
20+
21+
### 문제 설명
22+
23+
<p>"*"의 높이와 너비를 1이라고 했을 때, "*"을 이용해 직각 이등변 삼각형을 그리려고합니다. 정수 n 이 주어지면 높이와 너비가 n 인 직각 이등변 삼각형을 출력하도록 코드를 작성해보세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>1 ≤ <code>n</code> ≤ 10</li>
31+
</ul>
32+
33+
<hr>
34+
35+
<h5>입출력 예</h5>
36+
37+
<p>입력 #1</p>
38+
<div class="highlight"><pre class="codehilite"><code>3
39+
</code></pre></div>
40+
<p>출력 #1</p>
41+
<div class="highlight"><pre class="codehilite"><code>*
42+
**
43+
***
44+
</code></pre></div>
45+
<h5>입출력 예 설명</h5>
46+
47+
<p>입출력 예 #1</p>
48+
49+
<ul>
50+
<li>n이 3이므로 첫째 줄에 * 1개, 둘째 줄에 * 2개, 셋째 줄에 * 3개를 출력합니다.</li>
51+
</ul>
52+
53+
54+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Scanner;
2+
3+
public class Solution {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
int n = sc.nextInt();
7+
8+
for(int i=1; i<=n; i++){
9+
for(int j=1; j<=i; j++){
10+
System.out.printf("*");
11+
}
12+
if(i==n) break;
13+
System.out.println("");
14+
}
15+
16+
}
17+
}

0 commit comments

Comments
 (0)