티스토리 뷰
Kotlin(native / JVM)으로 풀어보기
1330 두 수 비교하기 (native)
fun readInt() = readLine()!!.split(' ').map { it.toInt() }
fun main() {
val (a, b) = readInt()
when {
a > b -> println(">")
a < b -> println("<")
a == b -> println("==")
}
}
9498 시험 성적 (native)
fun main() {
println(
when (readLine()?.toInt() ?: 0) {
in 90..100 -> "A"
in 80..89 -> "B"
in 70..79 -> "C"
in 60..69 -> "D"
else -> "F"
}
)
}
2753 윤년 (native)
fun isLeapYear(years: Int) = (years % 4 == 0 && years % 100 != 0 ) || years % 400 == 0
fun main() {
val years = readLine()?.toInt() ?: 0
println(
if (isLeapYear(years)) 1
else 0
)
}
2884 알람 시계 (native)
/**
* 확인해야 할 값
* 0:0 ~ 0: 44
* 0:45 ~ 23:59
*/
fun readInt() = readLine()!!.split(' ').map { it.toInt() }
fun main() {
var (hours, minutes) = readInt()
hours = if (minutes < 45) hours - 1 else hours
hours = if (hours < 0) hours + 24 else hours
minutes = if (minutes < 45) minutes + 15 else minutes - 45
println("$hours $minutes")
}
10817 세 수 (native)
fun readInt() = readLine()!!.split(' ').map { it.toInt() }
fun main() {
println(readInt().sorted()[1])
}'알고리즘 문제풀이 > BOJ' 카테고리의 다른 글
| [BOJ] 단계별로 풀어보기 - 6 (0) | 2020.02.12 |
|---|---|
| [BOJ] 백준 단계별로 풀어보기 - 5 (0) | 2020.02.12 |
| [BOJ] 백준 단계별로 풀어보기 - 4 (0) | 2020.02.12 |
| [BOJ] 백준 단계별로 풀어보기 - 3 (0) | 2020.02.08 |
| [BOJ] 백준 단계별로 풀어보기 - 1 (0) | 2020.01.31 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- git
- Summer/Winter Coding(~2018)
- Algorithm
- 그래프
- BOJ
- programmers
- Idempotent
- OS
- 2019 카카오 개발자 겨울 인턴십
- Python
- binary search
- dfs
- 깃
- 백준
- spring boot 2.3.1
- 이것이 코딩테스트다
- Algorihtm
- 알고리즘
- 그리디
- 구현
- DP
- 코틀린
- 정렬
- 자료구조
- 단계별로 문제풀이
- 열혈강의
- bfs
- repository
- 2020 카카오 인턴십
- 저장소
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함
