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.
___ ___ ___
| |__| |__| |
| |
\_________/
\_______/
| |
| |
| |
| |
|_____|
__/ \__
/ \
/_______________\
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
를 사용하면 사실 알아서 \
까지 붙여서 넣어줬다.
위의 문자열에서 다른건 다 그냥 입력해도 출력이 되지만 \
는 그렇지 않으니 \
를 출력해주기 위해선 \\
로 해줘야 \
가 출력된다.