結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2019-08-05 02:13:59 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 10,774 ms |
コンパイル使用メモリ | 235,380 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 03:40:29 |
合計ジャッジ時間 | 11,750 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
package main import ( "bufio" "fmt" "os" "regexp" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Scan() S := sc.Text() r := regexp.MustCompile(`c.*?w.*?w`) matches := r.FindAllStringSubmatch(S, -1) if len(matches) == 0 { fmt.Println("-1") return } min := 100 for _, v := range matches { if len(v[0]) < min { min = len(v[0]) } } fmt.Println(min) }