結果

問題 No.791 うし数列
ユーザー ktgw0316ktgw0316
提出日時 2019-04-08 22:06:03
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 11,047 ms
コンパイル使用メモリ 426,168 KB
実行使用メモリ 54,424 KB
最終ジャッジ日時 2024-04-30 20:17:18
合計ジャッジ時間 17,011 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 287 ms
54,152 KB
testcase_01 AC 288 ms
54,228 KB
testcase_02 AC 288 ms
54,268 KB
testcase_03 AC 291 ms
54,104 KB
testcase_04 AC 295 ms
54,040 KB
testcase_05 AC 288 ms
54,228 KB
testcase_06 AC 286 ms
54,240 KB
testcase_07 AC 289 ms
54,088 KB
testcase_08 AC 289 ms
54,224 KB
testcase_09 AC 291 ms
54,120 KB
testcase_10 AC 291 ms
54,236 KB
testcase_11 AC 289 ms
54,424 KB
testcase_12 AC 287 ms
54,216 KB
testcase_13 AC 288 ms
54,096 KB
testcase_14 AC 291 ms
54,160 KB
testcase_15 AC 284 ms
54,152 KB
testcase_16 AC 287 ms
54,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:6:1: warning: expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
inline fun ushi(N: String): Int {
^

ソースコード

diff #

fun main(args: Array<String>) {
    val N = readLine()!!
    println(ushi(N))
}

inline fun ushi(N: String): Int {
    val len = N.length
    if (len <= 1 || N[0] != '1') return -1
    val i = N.count {it == '3'}
    return if (i == len - 1) i else -1
}
0