結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
rutilicus
|
| 提出日時 | 2020-09-13 08:39:32 |
| 言語 | Kotlin (2.3.20) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 726 bytes |
| 記録 | |
| コンパイル時間 | 6,390 ms |
| コンパイル使用メモリ | 467,968 KB |
| 最終ジャッジ日時 | 2026-07-25 13:43:28 |
| 合計ジャッジ時間 | 7,082 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Main.kt:26:13: error: 'fun StringBuilder.appendln(value: Int): StringBuilder' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
builder.appendln(ans)
^^^^^^^^
ソースコード
import kotlin.math.sqrt
fun main() {
val builder = StringBuilder()
val (a, b) = readInputLine().split(" ").map { it.toInt() }
var ans = -1
for (c in 1..sqrt((a + b).toDouble()).toInt() + 1) {
if ((a + b) % c == 0 && c != a && c != b) {
if ((a + c) % b == 0 && (b + c) % a == 0) {
ans = c
break
}
}
val c2 = (a + b) / c
if ((a + b) % c2 == 0 && c2 != a && c2 != b) {
if ((a + c2) % b == 0 && (b + c2) % a == 0) {
ans = c2
break
}
}
}
builder.appendln(ans)
print(builder.toString())
}
fun readInputLine(): String {
return readLine()!!
}
rutilicus