我想读取两个 50 位数字并打印它们的总和,但我无法在 Kotlin 中输入 BigInteger。
最佳答案
您可以像在 中那样做Java :
val scanner = Scanner(System.`in`)
val first = scanner.nextBigInteger()
val second = scanner.nextBigInteger()
print(first + second)
或 您可以使用
readLine()
来自 kotlin.io
:val first = BigInteger(readLine())
val second = BigInteger(readLine())
print(first + second)
关于input - Kotlin 输入为 BigInteger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44756322/