結果

問題 No.791 うし数列
ユーザー keibkeib
提出日時 2019-03-05 13:40:26
言語 Swift
(5.10.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 146,780 KB
実行使用メモリ 13,116 KB
最終ジャッジ日時 2023-08-20 12:01:06
合計ジャッジ時間 2,080 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
12,940 KB
testcase_01 AC 6 ms
13,116 KB
testcase_02 AC 6 ms
12,572 KB
testcase_03 AC 6 ms
12,532 KB
testcase_04 AC 6 ms
12,588 KB
testcase_05 AC 6 ms
12,860 KB
testcase_06 AC 7 ms
13,000 KB
testcase_07 AC 6 ms
12,904 KB
testcase_08 AC 6 ms
12,688 KB
testcase_09 AC 6 ms
12,528 KB
testcase_10 AC 6 ms
12,700 KB
testcase_11 AC 6 ms
12,692 KB
testcase_12 AC 6 ms
13,040 KB
testcase_13 AC 6 ms
12,944 KB
testcase_14 AC 6 ms
12,476 KB
testcase_15 AC 6 ms
12,684 KB
testcase_16 AC 6 ms
12,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation 

let s = readLine()!
if s.count <= 1 {
    print(-1)
    exit(0)    
}

if s.prefix(1) != "1" {
    print(-1)
    exit(0)    
}

if s.suffix(s.count - 1).first(where: { $0 != "3" }) != nil {
    print(-1)
    exit(0)    
} 

print(s.count - 1)
0