본문 바로가기
👩‍💻 Programming/Coding Test 문제 풀이

[BaekJoon] 10171번 고양이_JavaScript

by codingBear 2022. 4. 1.
728x90
반응형

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

 

10171번: 고양이

아래 예제와 같이 고양이를 출력하시오.

www.acmicpc.net


Question

아래 예제와 같이 고양이를 출력하시오.

Input

없음

Output

고양이를 출력한다.


Example Input

 

Example Output

\    /\
 )  ( ')
(  /  )
 \(__)|

My Solutions

Solution1.

console.log(`\\    /\\
 )  ( ')
(  /  )
 \\(__)|`);

 

Solution2.

console.log(`\\    /\\`);
console.log(` )  ( ')`);
console.log(`(  /  )`);
console.log(` \\(__)|`);

백틱(`)을 사용하여 문자를 출력하는 문제이다. 백틱 내에서 백슬래시(\)를 출력하기 위해서는 백슬래시를 하나 더 겹쳐 써넣어야 한다. 참고로 백틱 내에서는 문자열과 태그라든지 변수를 조합해서 자유롭게 출력값을 작성할 수 있다.

728x90
반응형

댓글