結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-05 02:23:06 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 14,979 ms |
| コンパイル使用メモリ | 227,808 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 03:47:01 |
| 合計ジャッジ時間 | 13,597 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
func main() {
sc := bufio.NewScanner(os.Stdin)
sc.Scan()
S := sc.Text()
r := regexp.MustCompile(`c[^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)
}