結果

問題 No.537 ユーザーID
コンテスト
ユーザー 💕💖💞
提出日時 2017-07-01 06:40:56
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 557 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,038 ms
コンパイル使用メモリ 475,024 KB
実行使用メモリ 72,580 KB
最終ジャッジ日時 2026-05-14 13:20:18
合計ジャッジ時間 18,342 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:7:16: warning: redundant call of conversion method.
          it%i.toLong() == 0L -> Pair(i, it/i)
               ^^^^^^^^
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 #
raw source code

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