結果
問題 | No.791 うし数列 |
ユーザー |
|
提出日時 | 2019-06-11 13:09:18 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 406 bytes |
コンパイル時間 | 11,249 ms |
コンパイル使用メモリ | 220,116 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-06 01:14:23 |
合計ジャッジ時間 | 10,706 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
package main import "fmt" func main() { var line string fmt.Scan(&line) first := true count := 0 for _, l := range line { s := string(l) if first { if s != "1" { fmt.Println(-1) return } first = false continue } else { if s != "3" { fmt.Println(-1) return } else { count++ } } } if count == 0 { fmt.Println(-1) } else { fmt.Println(count) } }