結果

問題 No.290 1010
コンテスト
ユーザー yuki2006
提出日時 2015-10-16 21:28:06
言語 Go
(1.25.5)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 904 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,241 ms
コンパイル使用メモリ 246,300 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-01 16:42:57
合計ジャッジ時間 13,819 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

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

func main() {
	// Scan開始前にSplitを設定しないとPanicになるため、ここに移動
	s.Split(bufio.ScanWords)

	N := nextInt()
	S := next()

	if N >= 4 {
		fmt.Println("YES")
	}else {
		for ln := 1; ln <= N/2; ln++ {
			for i := 0; i < N-ln; i++ {
				if S[i:i+ln] == S[i+ln:i+2*ln] {
					fmt.Println("YES")
					return
				}
			}
		}
		fmt.Println("NO")

	}

}

var s = bufio.NewScanner(os.Stdin)

func next() string {
	// s.Split(bufio.ScanWords) // 削除: Scan後に呼ぶとPanicになるため
	s.Scan()
	return s.Text()
}
func nextLine() string {
	// s.Split(bufio.ScanLines) // 削除: 同上
	s.Scan()
	return s.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}
func nextLong() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}
0