結果

問題 No.791 うし数列
ユーザー keib
提出日時 2019-03-05 13:38:15
言語 Swift
(6.0.3)
結果
WA  
実行時間 -
コード長 260 bytes
コンパイル時間 10,207 ms
コンパイル使用メモリ 166,904 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2024-11-30 13:41:04
合計ジャッジ時間 2,669 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation 

let s = readLine()!
if s.isEmpty {
    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