結果

問題 No.1005 BOT対策
ユーザー oshou
提出日時 2020-03-09 08:43:29
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 13,099 ms
コンパイル使用メモリ 228,096 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 20:50:17
合計ジャッジ時間 11,568 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func count(str, substr string) int {
	cnt := 0
	for i := 0; i < len(str)-len(substr)+1; i++ {
		if str[i:i+len(substr)] == substr {
			cnt++
		}
	}
	return cnt
}

func main() {
	var cnt int
	var s, t string
	fmt.Scan(&s, &t)
	cnt = count(s, t)
	if cnt >= 1 && len(t) <= 1 {
		fmt.Println(-1)
	} else {
		fmt.Println(cnt)
	}
}
0