-
[백준] 10172번 : 개 - 코틀린(Kotlin)알고리즘/백준 2022. 10. 23. 00:01반응형
https://www.acmicpc.net/problem/10172
10172번: 개
문제 아래 예제와 같이 개를 출력하시오. 입력 출력 예제 입력 1 복사 예제 출력 1 복사 |\_/| |q p| /} ( 0 )"""\ |"^"` | ||_/=\\__|...
www.acmicpc.net
문제 해석
escape characterscharacters에 관한 내용 같습니다.
많은 언어들에서 ", \와 같은 예약어들이 존재하기 때문에 이런 것들을 출력하는 문제입니다.
코드
fun main() { println("|\\_/|") println("|q p| /}") println("( 0 )\"\"\"\\") println("|\"^\"` |") println("||_/=\\\\__|") }
조금 더 좋은 방법으로는 trimMargin을 이용하는 방법이 있습니다.
https://junuuu.tistory.com/503
출처
https://www.programiz.com/kotlin-programming/string
Kotlin String and String Templates (With Examples)
Kotlin String and String Templates In this article, you will learn about Kotlin strings, string templates, and few commonly used string properties and functions with the help of examples. Kotlin String Strings are a sequence of characters. For example, "He
www.programiz.com
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 9498 : 시험 성적 - 코틀린(Kotlin) (0) 2022.10.25 [백준] 10171번 : 고양이 - 코틀린(kotlin) (0) 2022.10.24 [백준] 10809번 : 알파벳 찾기 - 코틀린(kotlin) (0) 2022.10.21 [백준] 10871번 : X보다 작은 수 - 코틀린(Kotlin) (0) 2022.10.20 [백준] 11286번 : 절댓값 힙 - 자바(JAVA) (0) 2022.09.05