Problem:
Score : 200 points

Problem Statement

Given are a positive integer N and a string S of length N consisting of lowercase English letters.

Determine whether the string is a concatenation of two copies of some string.
That is, determine whether there is a string T such that S = T + T.

Constraints

1 \leq N \leq 100

S consists of lowercase English letters.

|S| = N

Input

Input is given from Standard Input in the following format:

N
S

Output

If S is a concatenation of two copies of some string, print Yes; otherwise, print No.

Sample Input 1

6
abcabc

Sample Output 1

Yes

Let T = abc, and S = T + T.

Sample Input 2

6
abcadc

Sample Output 2

No

Sample Input 3

1
z

Sample Output 3

No

Solution in Scala (2.11.7) (judge verdict: Accepted)

import java.io.PrintWriter

object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}

object OutPut {
  def print(f:PrintWriter => Unit): Unit = {
    val pw: PrintWriter = new java.io.PrintWriter(System.out)
    //pw.println("")
    f(pw)
    pw.flush()
  }
}
object MyDataFormat {
  def double(x: Double, precision: Int): String = {
    var num = x
    val sb = new StringBuilder
    if (num < 0) {
      sb.append("-")
      num = -num
    }
    num += Math.pow(10, -precision) / 2
    sb.append(num.toLong)
    sb.append(".")
    num -= num.toLong
    (0 until precision).foreach(i => {
      num *= 10
      sb.append(num.toInt)
      num -= num.toInt
    })
    sb.toString
  }

  def array2(arr: scala.collection.mutable.ArrayBuffer[scala.collection.mutable.ArrayBuffer[Int]], x: Int, y: Int): Option[Int] = {
    try { Some(arr(x)(y)) } catch {
      case _: Exception => None
    }
  }
}

object Loop {
  @inline def rep(n: Int, f: => Unit): Unit = { var c = 0; while (c < n) { f; c += 1 } }
  @inline def rep(n: Int, f: Int => Unit): Unit = { var c = 0; while (c < n) { f(c); c += 1 } }
}

object Search {
  def find(data: Array[Int], key: Int): Option[Int] = {
    val res = java.util.Arrays.binarySearch(data, key)
    if (res >= 0) Some(res) else None
  }
}

object WarshallFloyd {
  def run(n: Int, vectorMap: Array[Array[Int]]): Array[Array[Int]] = {
    Loop.rep(n, k => {
      Loop.rep(n, i => {
        Loop.rep(n, j => {
          val a = vectorMap(i)(j)

          val b = vectorMap(i)(k)
          val c = vectorMap(k)(j)
          val distance = Math.min(a, b + c)
          vectorMap(i)(j) = distance
        })
      })
    })
    vectorMap
  }
}

case class CumulativeSum(arr: Array[Int]) {
  val n = arr.length
  val sumArray: Array[Int] = Array.fill[Int](n + 1)(0)
  Loop.rep(n, i => sumArray(i + 1) = sumArray(i) + arr(i))

  //TODO 半開区間に変更
  //座標指定 上限下限共に含む
  def countByCoordinate(start: Int, end: Int): Int =
    countBySubscript(start - 1, end - 1)

  //添字指定 上限下限共に含む
  def countBySubscript(start: Int, end: Int): Int = {
    if (start <= end) sumArray(end + 1) - sumArray(start)
    else sumArray(start + 1) - sumArray(end)
  }
}

case class UnionFind(n: Int) {
  //添字が固有ID、値が親IDを表す
  val arr: Array[Int] = Array.tabulate[Int](n)(identity)
  def findParent(v: Int): Int = {
    val parent = arr(v)
    if (v == parent) parent else findParent(parent)
  }
  def registerParent(child: Int, parent: Int): Unit = {
    val oldParent = arr(child)
    arr(oldParent) = parent
  }
}

object PrimeNumbers {
  def isPrimeNumber(n: Int): Boolean = ???
  def createUntil(n: Int): Array[Int] = {
    val arr: Array[Int] = Array.empty
    //i = 2からスタートしたいので全体をずらす
    Loop.rep(n - 2, i => {
      //自身より小さい全ての素数で割り切れなければ、素数
      if (!arr.exists(v => i % v == 0)) {
        //append
      }
    })
    arr
  }
}



object Main extends App {
  val n = Scanner.nextInt()
  val s = Scanner.next()

  if (n % 2 == 0) {
    val (a, b) = s.splitAt(n / 2)
    if (a == b) println("Yes") else println("No")
  } else println("No")
}