結果

問題 No.232 めぐるはめぐる (2)
ユーザー yukirinyukirin
提出日時 2016-02-28 16:39:56
言語 Go
(1.22.1)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 1,291 bytes
コンパイル時間 13,155 ms
コンパイル使用メモリ 209,772 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 13:44:30
合計ジャッジ時間 14,991 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
4,352 KB
testcase_01 AC 139 ms
4,352 KB
testcase_02 AC 139 ms
4,352 KB
testcase_03 AC 140 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 98 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,356 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 3 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	sc.Split(bufio.ScanWords)
	t, a, b := nextInt(), nextInt(), nextInt()

	c := a
	if b > a {
		c = b
	}

	if c > t {
		fmt.Println("NO")
		return
	}

	if t == 1 && a == 0 && b == 0 {
		fmt.Println("NO")
		return
	}

	fmt.Println("YES")
	detour := t - c

	if a == 0 && b == 0 && detour%2 == 1 {
		fmt.Println("<v")
		for i := 0; i < t-2; i++ {
			if i%2 == 0 {
				fmt.Println("^")
			} else {
				fmt.Println("v")
			}
		}
		fmt.Println(">")
		return
	}

	for i := 0; i < detour/2; i++ {
		fmt.Println("v")
		fmt.Println("^")
	}

	m := a
	if b < a {
		m = b
	}

	flag := false
	if detour%2 == 1 && m != 0 {
		m--
		flag = true
		fmt.Println(">")
		fmt.Println("^")
	}

	for i := 0; i < m; i++ {
		fmt.Println(">^")
	}

	if flag {
		m++
	}

	if m == 0 && detour%2 == 1 {
		if a > 0 {
			fmt.Println("<")
			fmt.Println(">^")
			a--
		} else {
			fmt.Println("v")
			fmt.Println(">^")
			b--
		}
	}

	for i := 0; i < a-m; i++ {
		fmt.Println("^")
	}
	for i := 0; i < b-m; i++ {
		fmt.Println(">")
	}
	return
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}
0