結果

問題 No.1175 Simultaneous Equations
ユーザー 👑 箱
提出日時 2020-08-21 21:30:02
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 13,887 ms
コンパイル使用メモリ 417,240 KB
実行使用メモリ 50,612 KB
最終ジャッジ日時 2023-08-05 07:36:06
合計ジャッジ時間 18,804 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 268 ms
50,612 KB
testcase_01 AC 264 ms
50,348 KB
testcase_02 AC 266 ms
50,432 KB
testcase_03 AC 267 ms
50,340 KB
testcase_04 AC 267 ms
50,444 KB
testcase_05 AC 268 ms
50,348 KB
testcase_06 AC 267 ms
50,440 KB
testcase_07 AC 263 ms
50,416 KB
testcase_08 AC 268 ms
50,416 KB
testcase_09 AC 270 ms
50,436 KB
testcase_10 AC 264 ms
50,356 KB
testcase_11 AC 266 ms
50,532 KB
testcase_12 AC 264 ms
50,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()
    val e = sc.nextInt()
    val f = sc.nextInt()
    val g = (a * e - b * d).toDouble()
    val x = (c * e - b * f) / g
    val y = (a * f - c * d) / g
    println("$x $y")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}
0