Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- JDBC수정
- xcode #swift공부
- 이클립스에서sql자료넣기
- jdbc
- 이클립스에서오라클데이터
- JDBC데이터삽입
- xcode #swift #app만들기이미지 #ios앱만들기
- xcode앱만들기 #swift #uikit
- jdbc값검색
- JDBCinsert
- 이클립스에서SQL
- xcode 깃오류
- JDBCUPDATE
- 이클립스에서sql데이터삽입
- 자바SQL
- 오라클데이터수정자바
- jwt #세션 #토큰 #로그인유지 #java
- swift화면전환
- 자바정수변환
- 이클립스커넥션아이디오류
- 이클립스에서오라클데이터수정
- 이클립스로오라클데이터출력
- 자바SQLUPDATE
- xcode #swift #ios앱만들기 #swift배열
- jdbcconnection_id오류
- jdbcselect
- xcode앱만들기 #xcode기초
- replaceall여러문자 #javareplaceall
- jdbc셀렉트
- DATE데이터타입
Archives
- Today
- Total
Yim-HaEun
[백준 10992]별 찍기 17번 문제 풀이 본문
정답은 맨 아래 있습니다.
값을 입력받고 맨 마지막 줄인 바닥을 먼저 깔아줍니다.
for(int i=0;i<n;i++) {//n+n-1개바닥
System.out.printf("*");
}for(int j=0;j<n-1;j++) {
System.out.printf("*");
}
공백 ,*,공백,*이 필요한데 if(i=0){ 이부분은
for(int i=0;i<n-1;i++) {
for(int j=n-i-1;j>0;j--) {
System.out.print(" ");
}
System.out.print("*");//공백뒤에 *를 찍음.
for(int k=0;k<i;k++) {
System.out.print(" ");
}
for(int z =1;z<i;z++) {
System.out.print(" ");
}
if(i!=0) {//첫쨋줄에는 마지막 별을 안찍겠다는 의미입니다.
System.out.print("*");//줄이 넘어갈때마다 *를 찍습니다.
}
System.out.println();
}
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n =scan.nextInt();
for(int i=0;i<n-1;i++) {
for(int j=n-i-1;j>0;j--) {
System.out.print(" ");
}
System.out.print("*");
for(int k=0;k<i;k++) {
System.out.print(" ");
}
for(int z =1;z<i;z++) {
System.out.print(" ");
}
if(i!=0) {
System.out.print("*");
}
System.out.println();
}
for(int i=0;i<n;i++) {//바닥
System.out.printf("*");
}for(int j=0;j<n-1;j++) {
System.out.printf("*");
}
scan.close();
}
}
'Java > Programmers 코테 풀이' 카테고리의 다른 글
[java] 정수 변환을 위해 Character.getNumericValue()를 사용해보자. (1) | 2024.09.26 |
---|---|
[백준 11948번]Arrays 와 Collections를 이용해 내림차순 정렬하기 (2) | 2024.09.25 |
[백준] 백준 랭크올리기, 롤 티어 올리기보다 쉽다?(Silver 5 달성)/ Bronze5 문제풀기 완. (0) | 2024.09.23 |
[백준]11718번 그대로 출력하기 문제 풀다가 화나서 쓰는 글 (지나가십쇼) (0) | 2024.09.22 |
[백준] 3052번 나머지 / HashSet을 사용하여 해결해보자 (0) | 2024.09.22 |