結果

問題 No.342 一番ワロタww
ユーザー javyjavy
提出日時 2016-02-12 22:51:58
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,887 bytes
コンパイル時間 13,164 ms
コンパイル使用メモリ 441,772 KB
実行使用メモリ 54,408 KB
最終ジャッジ日時 2024-04-30 12:13:00
合計ジャッジ時間 19,719 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 295 ms
54,252 KB
testcase_01 AC 296 ms
54,288 KB
testcase_02 AC 296 ms
54,284 KB
testcase_03 AC 297 ms
54,168 KB
testcase_04 AC 296 ms
54,144 KB
testcase_05 AC 301 ms
54,156 KB
testcase_06 AC 298 ms
54,328 KB
testcase_07 AC 304 ms
54,400 KB
testcase_08 AC 307 ms
54,400 KB
testcase_09 AC 297 ms
54,168 KB
testcase_10 AC 297 ms
54,280 KB
testcase_11 AC 304 ms
54,408 KB
testcase_12 AC 300 ms
54,252 KB
testcase_13 AC 299 ms
54,268 KB
testcase_14 AC 301 ms
54,264 KB
testcase_15 AC 301 ms
54,240 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 && list[i].length != 0) {
            println(list[i])

        }
    }
}
0