[백준] 2393

당당·2023년 5월 25일
0

백준

목록 보기
124/179

https://www.acmicpc.net/problem/2393

📔문제

You have just learned how to output text to the screen and your teacher has challenged you to create an ASCII art of a chess piece. You have decided to make your favorite piece, the rook.


📺출력

The rook art, exactly as shown below, with no extra blank spaces. In particular, a line must not end with a blank space.


📝예제 입력 1


📺예제 출력 1

  ___  ___  ___
  | |__| |__| |
  |           |
   \_________/
    \_______/
     |     |
     |     |
     |     |
     |     |
     |_____|
  __/       \__
 /             \
/_______________\

🔍출처

High School > PLU High School Programming Contest > PLU 2020 > Novice 10번
High School > PLU High School Programming Contest > PLU 2020 > Advanced 8번


🧮알고리즘 분류

  • 구현

📃소스 코드

public class Code2393 {
    public static void main(String[] args) {
        System.out.println("  ___  ___  ___");
        System.out.println("  | |__| |__| |");
        System.out.println("  |           |");
        System.out.println("   \\_________/"); // \는 앞에 \ 한번 더 필요함
        System.out.println("    \\_______/");
        System.out.println("     |     |");
        System.out.println("     |     |");
        System.out.println("     |     |");
        System.out.println("     |     |");
        System.out.println("     |_____|");
        System.out.println("  __/       \\__");
        System.out.println(" /             \\");
        System.out.println("/_______________\\");
    }
}


📰출력 결과


📂고찰

IDE를 사용하면 사실 알아서 \까지 붙여서 넣어줬다.

위의 문자열에서 다른건 다 그냥 입력해도 출력이 되지만 \는 그렇지 않으니 \를 출력해주기 위해선 \\로 해줘야 \가 출력된다.

profile
MySQL DBA 신입 지원

0개의 댓글