結果
問題 | No.706 多眼生物の調査 |
ユーザー |
![]() |
提出日時 | 2018-07-22 00:38:50 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 578 ms / 2,000 ms |
コード長 | 322 bytes |
コンパイル時間 | 14,248 ms |
コンパイル使用メモリ | 440,032 KB |
実行使用メモリ | 74,520 KB |
最終ジャッジ日時 | 2024-11-20 16:33:07 |
合計ジャッジ時間 | 16,191 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args:Array<String>) { ^ Main.kt:3:38: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Pair<Int, Int> val maxSec = dd.maxBy { it.second }!!.second ^ Main.kt:4:26: warning: destructured parameter 'k' is never used val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!! ^ Main.kt:4:64: warning: destructured parameter 'size' is never used val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!! ^ Main.kt:4:82: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!! ^
ソースコード
fun main(args:Array<String>) {val dd = (1..readLine()!!.toInt()).map { readLine()!!.toList().filter { it == '^' }.size }.groupBy { it }.map { (k,vs) -> Pair(k, vs.size) }val maxSec = dd.maxBy { it.second }!!.secondval res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!!println(res)}