結果

問題 No.1005 BOT対策
ユーザー oshouoshou
提出日時 2020-03-09 08:43:29
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 11,967 ms
コンパイル使用メモリ 222,952 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 10:14:00
合計ジャッジ時間 10,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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