27880번: Gahui and Soongsil University station백준/문제2024. 6. 27. 15:13
Table of Contents
문제 출처 : https://www.acmicpc.net/problem/27880
언어 : Kotlin
문제 설명 :
Soongsil University Station is famous as the deepest station on Seoul Subway Line 7. This station is so deep that the platform is on the B6. Gahui was surprised that she did not reach the platform after more than five minutes from the exit. Gahui wants to know how deep Soongsil University station is. Find the depth of the Soongsil University station.
Depth is the vertical distance from the exit to the platform.
입력 :
line | {floor1} | {floor2} |
1 | F1 | B1 |
2 | B1 | B2 |
3 | B2 | B5 |
4 | B5 | B6 |
[Table 1] Description of the given input
For every two adjacent floors ordered by depth, the information is given on a line as follows:
- Stair x
- If you go down x stairs from the {floor1} floor, you will reach the {floor2} floor.
- Es x
- If you go down the escalator with x steps from the {floor1} floor, you will reach the {floor2} floor.
출력 :
Print the answer in cm. If the answer is 5096cm, print 5096.
제한 사항 :
- 시간 제한 : 1초
- 메모리 제한 : 1024MB
- The height of 1 escalator step is 21cm, and the height of 1 stair is 17cm.
The answer ≤ 6425
All exits are at the same elevation.
All platforms are at the same elevation.
There is no change in elevation at the same platform.
x is integer.
입출력 예 :
입력 | 출력 |
Es 20 Stair 15 Stair 15 Stair 15 |
1185 |
풀이 :
import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.InputStreamReader
import java.io.OutputStreamWriter
fun main() = with(BufferedReader(InputStreamReader(System.`in`))) {
val bw = BufferedWriter(OutputStreamWriter(System.out))
var result = 0
var input: String?
while (true) {
input = readLine()
if (input.isNullOrEmpty()) break
input.split(" ").also {
if (it[0] == "Es") result += it[1].toInt() * 21
if (it[0] == "Stair") result += it[1].toInt() * 17
}
}
bw.write("$result")
bw.flush()
bw.close()
}
'백준 > 문제' 카테고리의 다른 글
26768번: H4x0r (0) | 2024.06.28 |
---|---|
15786번: Send me the money (0) | 2024.06.28 |
17828번: 문자열 화폐 (0) | 2024.06.27 |
17548번: Greetings! (0) | 2024.06.27 |
26594번: ZOAC 5 (0) | 2024.06.26 |
@스몰스테핑 :: 작은 발걸음
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!