結果

問題 No.342 一番ワロタww
ユーザー javyjavy
提出日時 2016-02-12 22:49:55
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,863 bytes
コンパイル時間 10,246 ms
コンパイル使用メモリ 435,744 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2024-04-30 12:11:19
合計ジャッジ時間 15,399 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 245 ms
54,168 KB
testcase_01 AC 248 ms
54,180 KB
testcase_02 AC 243 ms
54,196 KB
testcase_03 AC 245 ms
54,308 KB
testcase_04 WA -
testcase_05 AC 244 ms
54,288 KB
testcase_06 AC 245 ms
54,400 KB
testcase_07 AC 250 ms
54,304 KB
testcase_08 AC 246 ms
54,368 KB
testcase_09 AC 247 ms
54,356 KB
testcase_10 AC 247 ms
54,372 KB
testcase_11 AC 249 ms
54,484 KB
testcase_12 AC 239 ms
54,304 KB
testcase_13 AC 242 ms
54,080 KB
testcase_14 AC 244 ms
54,312 KB
testcase_15 AC 249 ms
54,308 KB
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:4:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:53:17: warning: variable 'count' initializer is redundant
    var count = 0
                ^

ソースコード

diff #

import java.util.regex.Matcher
import java.util.regex.Pattern

fun main(args: Array<String>) {
    fun readLineLongArray(): List<Long> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toLong() }
        return ret
    }

    fun readLineLong(): Long {
        val str = readLine() as String
        return str.toLong()
    }

    fun readLineInt(): Int {
        val str = readLine() as String
        return str.toInt()
    }

    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }

    fun readLineDoubleArray(): List<Double> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toDouble() }
        return ret
    }

    fun readLineDouble() : Double {
        val str = readLine() as String
        return str.toDouble()
    }

    fun readLineString() : String {
        return readLine() as String
    }

    //    fun readLineStringArray(): List<String> {
    //        val str = readLine() as String
    //        val arrStr = str.split(" ")
    //        return arrStr
    //    }

    val str = readLineString()
    var index = 0
    var count = 0
    var maxN = 0
    val p : Pattern = Pattern.compile("w+")
    val m : Matcher = p.matcher(str)
    var list = arrayListOf<String>()
    var lenList = arrayListOf<Int>()
    while (m.find()) {
//        println(m.group())
        count = m.group().length
        if (maxN <= count) {
            list.add(str.substring(index,m.start()))
            lenList.add(count)
            maxN = count
        }
        index = m.end()
    }
    for ((i,item) in lenList.withIndex()) {
        if (item == maxN) {
            println(list[i])
        }
    }
}
0