結果

問題 No.537 ユーザーID
ユーザー 💕💖💞
提出日時 2017-07-01 06:40:56
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 457 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 11,805 ms
コンパイル使用メモリ 433,440 KB
実行使用メモリ 77,496 KB
最終ジャッジ日時 2024-11-20 10:50:23
合計ジャッジ時間 26,104 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:11: warning: parameter 'args' is never used
fun main( args : Array<String> ) {
          ^
Main.kt:15:45: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Pair<Long, Long>
          listOf( it!!.first.toString() + it!!.second.toString() , it!!.second.toString() + it!!.first.toString() )
                                            ^
Main.kt:15:70: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Pair<Long, Long>
          listOf( it!!.first.toString() + it!!.second.toString() , it!!.second.toString() + it!!.first.toString() )
                                                                     ^
Main.kt:15:95: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Pair<Long, Long>
          listOf( it!!.first.toString() + it!!.second.toString() , it!!.second.toString() + it!!.first.toString() )
                                                                                              ^

ソースコード

diff #

import java.lang.Math
fun main( args : Array<String> ) {
  readLine()!!.toLong()
    .let {
      (1..Math.pow(it.toDouble(), 0.5).toLong()).map { i ->
        when { 
          it%i.toLong() == 0L -> Pair(i, it/i)
          else -> null
        }
      }.filter { 
        it != null 
      }.toSet()
      .let {
        it.map {
          listOf( it!!.first.toString() + it!!.second.toString() , it!!.second.toString() + it!!.first.toString() )
        }.flatMap { it 
        }.toSet()
        .let {
          println(it.size)
        }
      }
    }
}
0