結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー yo-kondoyo-kondo
提出日時 2018-03-25 12:17:59
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 11,984 ms
コンパイル使用メモリ 431,724 KB
実行使用メモリ 67,800 KB
最終ジャッジ日時 2024-04-30 17:31:00
合計ジャッジ時間 23,272 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 351 ms
57,192 KB
testcase_01 WA -
testcase_02 AC 315 ms
56,924 KB
testcase_03 AC 315 ms
56,900 KB
testcase_04 AC 312 ms
56,828 KB
testcase_05 AC 503 ms
67,616 KB
testcase_06 AC 310 ms
56,852 KB
testcase_07 AC 310 ms
56,816 KB
testcase_08 AC 312 ms
56,800 KB
testcase_09 AC 312 ms
56,832 KB
testcase_10 AC 311 ms
56,696 KB
testcase_11 AC 314 ms
56,828 KB
testcase_12 AC 310 ms
56,816 KB
testcase_13 AC 311 ms
56,920 KB
testcase_14 AC 498 ms
63,500 KB
testcase_15 AC 422 ms
59,188 KB
testcase_16 AC 490 ms
65,624 KB
testcase_17 WA -
testcase_18 AC 504 ms
65,684 KB
testcase_19 AC 476 ms
63,632 KB
testcase_20 AC 491 ms
67,700 KB
testcase_21 AC 330 ms
57,100 KB
testcase_22 WA -
testcase_23 AC 492 ms
67,756 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package yukicoder.no79

/**
 * エントリポイント
 */
fun main(args: Array<String>) {
    val in1 = readLine()
    val in2 = readLine()
    println(majorityVote(in1, in2))
}

/**
 * 回答が一番多いレベルを返します。
 * @param num 評価した人数
 * @param evaluation ユーザーの評価
 */
fun majorityVote(@Suppress("UNUSED_PARAMETER") num: String?,
                 evaluation: String?): String {
    if (evaluation == null) {
        return ""
    }
    val sp = evaluation.split(" ").map { it.toInt() }
    val group = sp.groupBy { it }

    var maxKey = 0
    var maxValue = 0
    for ((k, v) in group) {
        if (maxValue <= v.size && maxKey < k) {
            maxValue = v.size
            maxKey = k
        }
    }
    return maxKey.toString()
}
0