結果

問題 No.549 素材合成システム
ユーザー 💕💖💞
提出日時 2017-09-12 00:01:23
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 12,889 ms
コンパイル使用メモリ 438,824 KB
実行使用メモリ 74,000 KB
最終ジャッジ日時 2024-11-20 12:04:50
合計ジャッジ時間 37,369 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^
Main.kt:8:14: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
  println(max!! + n)
             ^

ソースコード

diff #

fun main(args: Array<String>){
  readLine()
  val ss = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
  val max = ss.max()
  val maxindex = ss.indexOf(max)
  ss.removeAt(maxindex)
  val n = ss.map { it/2 }.reduce { y,x -> y+x }
  println(max!! + n)
}
0