結果

問題 No.430 文字列検索
ユーザー jugemjugemjugemjugemjugemjugem
提出日時 2016-10-06 00:24:54
言語 Go
(1.22.1)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 11,866 ms
コンパイル使用メモリ 237,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 04:39:29
合計ジャッジ時間 13,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 194 ms
5,248 KB
testcase_02 AC 83 ms
5,376 KB
testcase_03 AC 84 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 78 ms
5,376 KB
testcase_12 AC 83 ms
5,376 KB
testcase_13 AC 82 ms
5,376 KB
testcase_14 AC 83 ms
5,376 KB
testcase_15 AC 82 ms
5,376 KB
testcase_16 AC 83 ms
5,376 KB
testcase_17 AC 83 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)
import "strings"

func main() {
  var sc = bufio.NewScanner(os.Stdin)
  var os, ns,t string
  var n int
  var c int
  var err error
  var ts string

  if sc.Scan() {
    os = sc.Text()
  }
  if sc.Scan() {
    ts = sc.Text()
    n ,err = strconv.Atoi(ts)
    if err != nil {
      fmt.Print("error")
    }
  }
  c = 0
  var i int
  for i = 0; i < n; i++ {
    ns = os
    if sc.Scan() {
      t = sc.Text()
      var pos int
      pos = strings.Index(ns,t )
      ns = ns[pos+1:len(ns)]
      for ; pos != -1 ; {
        c += 1
        pos = strings.Index(ns,t )
        ns = ns[pos+1:len(ns)]
      }
    }
  }
  fmt.Println(c)
}
0