結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 302 ms
57,180 KB
testcase_01 AC 435 ms
67,648 KB
testcase_02 AC 273 ms
56,804 KB
testcase_03 AC 271 ms
56,856 KB
testcase_04 AC 268 ms
56,872 KB
testcase_05 AC 469 ms
67,640 KB
testcase_06 AC 332 ms
56,868 KB
testcase_07 AC 269 ms
56,964 KB
testcase_08 AC 282 ms
56,864 KB
testcase_09 AC 282 ms
56,992 KB
testcase_10 AC 278 ms
56,932 KB
testcase_11 AC 278 ms
56,956 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 432 ms
63,632 KB
testcase_15 AC 373 ms
59,432 KB
testcase_16 AC 431 ms
65,688 KB
testcase_17 AC 362 ms
59,424 KB
testcase_18 AC 438 ms
65,680 KB
testcase_19 AC 436 ms
63,544 KB
testcase_20 AC 433 ms
67,800 KB
testcase_21 AC 289 ms
57,100 KB
testcase_22 AC 376 ms
59,372 KB
testcase_23 AC 468 ms
67,804 KB
testcase_24 AC 435 ms
67,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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) {
            maxValue = v.size
            maxKey = k
        }
    }
    return maxKey.toString()
}
0