Muh*_*gdi 4 input biginteger kotlin
我想要阅读两个50位数字并打印它们的总和,但我无法在Kotlin中获得BigInteger的输入.
您可以像在Java中一样进行:
val scanner = Scanner(System.`in`)
val first = scanner.nextBigInteger()
val second = scanner.nextBigInteger()
print(first + second)
Run Code Online (Sandbox Code Playgroud)
或者您可以使用readLine()从kotlin.io:
val first = BigInteger(readLine())
val second = BigInteger(readLine())
print(first + second)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
397 次 |
| 最近记录: |