import java.util.Scanner import scala.annotation.tailrec object Problem232 { def proc(t: Int, a: Int, b: Int): List[String] = { if (a > t || b > t) { return List("NO") } if (t == 1 && a == 0 && b == 0) { return List("NO") } @tailrec def procR(t: Int, a: Int, b: Int, route: List[String]): List[String] = { // 最短距離で進む // 着いたら左下に戻る // 2ターン前にあと1歩で着く場合は1歩回り道する (t, a, b) match { case (0, 0, 0) => route case (_, 0, 0) => procR(t - 1, 1, 1, " procR(t - 1, 1, 1, "v" :: route) case (2, 1, 0) => procR(t - 1, 1, 1, "<" :: route) case (2, 1, 1) => procR(t - 1, 1, 0, ">" :: route) case (_, 0, _) => procR(t - 1, a, b - 1, ">" :: route) case (_, _, 0) => procR(t - 1, a - 1, b, "^" :: route) case (_, _, _) => procR(t - 1, a - 1, b - 1, "^>" :: route) } } "YES" :: procR(t, a, b, List()).reverse } def main(args: Array[String]) { val sc = new Scanner(System.in) val (t, a, b) = (sc.nextInt, sc.nextInt, sc.nextInt) val results = proc(t, a, b) println(results.mkString("\n")) } }