[백준] Adding Reversed Numbers (3486)(kotlin)
문제 설명
입력 및 출력
» 입력
The input consists of N cases. The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the reversed numbers you are to add. Two integers are less than 100,000,000.
» 출력
For each case, print exactly one line containing only one integer - the reversed sum of two reversed numbers. Omit any leading zeros in the output.
예제 입출력(테스트케이스)
입력 | 출력 |
---|---|
3 24 1 4358 754 305 794 |
34 1998 1 |
문제 풀이1
import java.io.BufferedReader
import java.io.InputStreamReader
fun main(args: Array<String>) = with(BufferedReader(InputStreamReader(System.`in`))) {
repeat(readLine().toInt()) {
println(
readLine()
.split(" ")
.map { it.reversed().toInt() }
.sum()
.toString()
.reversed()
.toInt()
)
}
}