結果

問題 No.1738 What's in the box?
ユーザー 👑 箱
提出日時 2021-11-12 22:24:52
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 385 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 19,420 ms
コンパイル使用メモリ 419,656 KB
実行使用メモリ 60,844 KB
最終ジャッジ日時 2023-08-17 02:20:34
合計ジャッジ時間 44,478 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 315 ms
60,844 KB
testcase_01 AC 335 ms
57,320 KB
testcase_02 AC 376 ms
57,076 KB
testcase_03 AC 385 ms
57,312 KB
testcase_04 AC 373 ms
59,136 KB
testcase_05 AC 364 ms
59,128 KB
testcase_06 AC 365 ms
58,956 KB
testcase_07 AC 368 ms
57,192 KB
testcase_08 AC 360 ms
57,164 KB
testcase_09 AC 358 ms
59,088 KB
testcase_10 AC 357 ms
59,132 KB
testcase_11 AC 354 ms
58,960 KB
testcase_12 AC 359 ms
57,596 KB
testcase_13 AC 364 ms
57,172 KB
testcase_14 AC 359 ms
58,848 KB
testcase_15 AC 351 ms
57,288 KB
testcase_16 AC 348 ms
57,424 KB
testcase_17 AC 345 ms
59,316 KB
testcase_18 AC 339 ms
57,124 KB
testcase_19 AC 345 ms
58,832 KB
testcase_20 AC 338 ms
58,884 KB
testcase_21 AC 343 ms
57,008 KB
testcase_22 AC 341 ms
59,172 KB
testcase_23 AC 343 ms
57,372 KB
testcase_24 AC 363 ms
57,468 KB
testcase_25 AC 361 ms
57,168 KB
testcase_26 AC 365 ms
58,968 KB
testcase_27 AC 357 ms
60,712 KB
testcase_28 AC 362 ms
58,964 KB
testcase_29 AC 348 ms
59,072 KB
testcase_30 AC 350 ms
57,060 KB
testcase_31 AC 338 ms
57,016 KB
testcase_32 AC 334 ms
58,960 KB
testcase_33 AC 355 ms
57,244 KB
testcase_34 AC 352 ms
59,348 KB
testcase_35 AC 351 ms
59,040 KB
testcase_36 AC 356 ms
57,084 KB
testcase_37 AC 350 ms
59,084 KB
testcase_38 AC 370 ms
57,364 KB
testcase_39 AC 350 ms
59,252 KB
testcase_40 AC 344 ms
57,432 KB
testcase_41 AC 349 ms
57,304 KB
testcase_42 AC 371 ms
57,320 KB
testcase_43 AC 363 ms
57,192 KB
testcase_44 AC 353 ms
57,284 KB
testcase_45 AC 349 ms
59,384 KB
testcase_46 AC 353 ms
57,280 KB
testcase_47 AC 345 ms
57,412 KB
testcase_48 AC 350 ms
59,320 KB
testcase_49 AC 352 ms
59,100 KB
testcase_50 AC 348 ms
57,224 KB
testcase_51 AC 351 ms
59,044 KB
testcase_52 AC 347 ms
59,044 KB
testcase_53 AC 331 ms
58,940 KB
testcase_54 AC 334 ms
57,080 KB
testcase_55 AC 337 ms
57,164 KB
testcase_56 AC 333 ms
58,928 KB
testcase_57 AC 334 ms
57,148 KB
testcase_58 AC 330 ms
57,372 KB
testcase_59 AC 343 ms
58,992 KB
testcase_60 AC 334 ms
57,172 KB
testcase_61 AC 336 ms
59,308 KB
testcase_62 AC 335 ms
56,984 KB
testcase_63 AC 333 ms
57,072 KB
testcase_64 AC 335 ms
59,096 KB
testcase_65 AC 331 ms
58,964 KB
testcase_66 AC 336 ms
59,120 KB
testcase_67 AC 331 ms
57,204 KB
testcase_68 AC 335 ms
56,940 KB
testcase_69 AC 347 ms
57,108 KB
testcase_70 AC 346 ms
59,112 KB
testcase_71 AC 344 ms
57,060 KB
testcase_72 AC 352 ms
59,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val m = nextLong()
    val w = Array(n) { nextLong() }
    val s = w.sum()
    if (s == 0L) {
        println(Array(n) { 0 }.joinToString(" "))
    } else {
        println(w.map { it * m / s }.joinToString(" "))
    }
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

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()
// endregion
0