結果

問題 No.29 パワーアップ
ユーザー javyjavy
提出日時 2015-12-07 02:26:59
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 310 ms / 5,000 ms
コード長 1,381 bytes
コンパイル時間 14,083 ms
コンパイル使用メモリ 423,636 KB
実行使用メモリ 54,780 KB
最終ジャッジ日時 2023-08-12 16:53:01
合計ジャッジ時間 22,383 ms
ジャッジサーバーID
(参考情報)
judge12 / judge7
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 297 ms
52,528 KB
testcase_01 AC 303 ms
52,952 KB
testcase_02 AC 299 ms
52,716 KB
testcase_03 AC 302 ms
53,044 KB
testcase_04 AC 297 ms
52,740 KB
testcase_05 AC 309 ms
52,728 KB
testcase_06 AC 308 ms
52,836 KB
testcase_07 AC 310 ms
52,844 KB
testcase_08 AC 306 ms
52,784 KB
testcase_09 AC 295 ms
53,420 KB
testcase_10 AC 303 ms
52,800 KB
testcase_11 AC 307 ms
52,664 KB
testcase_12 AC 299 ms
52,760 KB
testcase_13 AC 309 ms
52,788 KB
testcase_14 AC 305 ms
52,720 KB
testcase_15 AC 302 ms
52,916 KB
testcase_16 AC 305 ms
52,800 KB
testcase_17 AC 305 ms
54,780 KB
testcase_18 AC 306 ms
52,828 KB
testcase_19 AC 306 ms
53,036 KB
testcase_20 AC 306 ms
52,648 KB
testcase_21 AC 304 ms
52,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package Yukicoder

fun main(args: Array<String>) {
    fun readLineLongArray(): List<Long> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toLong() }
        return ret
    }

    fun readLineLong(): Long {
        val str = readLine() as String
        return str.toLong()
    }

    fun readLineInt(): Int {
        val str = readLine() as String
        return str.toInt()
    }

    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }

    fun readLineDoubleArray(): List<Double> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toDouble() }
        return ret
    }

    fun readLineDouble() : Double {
        val str = readLine() as String
        return str.toDouble()
    }


//    fun readLineStringArray(): List<String> {
//        val str = readLine() as String
//        val arrStr = str.split(" ")
//        return arrStr
//    }

    val num = readLineInt()
    var arr = Array<Int>(10, {0})
    for (i in 1..num) {
        val input = readLineIntArray()
        for (item in input) {
            arr[(item-1)]++
        }
    }

    val ans = arr.map { it/2 }.sum() + arr.map { it%2 }.sum()/4
    println(ans)
}
0