結果

問題 No.351 市松スライドパズル
ユーザー yuki2006yuki2006
提出日時 2016-03-11 23:53:29
言語 Go
(1.22.1)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 12,582 ms
コンパイル使用メモリ 222,808 KB
実行使用メモリ 26,768 KB
最終ジャッジ日時 2023-10-25 07:19:24
合計ジャッジ時間 14,933 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
22,464 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 87 ms
26,736 KB
testcase_14 AC 87 ms
26,756 KB
testcase_15 AC 88 ms
26,768 KB
testcase_16 AC 88 ms
26,760 KB
testcase_17 AC 82 ms
26,756 KB
testcase_18 AC 82 ms
26,764 KB
testcase_19 AC 87 ms
26,748 KB
testcase_20 AC 88 ms
26,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	var H, W, N int
	fmt.Scanf("%d %d", &H, &W)
	fmt.Scanf("%d", &N)

	SKs := make([]string, N)
	b := bufio.NewReader(os.Stdin)
	for i := 0; i < N; i++ {
		var e error
		var bs []byte
		bs, _, e = b.ReadLine()
		if e != nil {
			panic(e)
		}
		SKs[i] = string(bs)
	}
	h := 0
	w := 0
	for i := N - 1; i >= 0; i-- {
		v, e := strconv.Atoi(SKs[i][2:])
		if e != nil {
			panic(e)
		}
		if SKs[i][0] == 'R' {
			if v == h {
				w = (w - 1 + W) % W
			}
		}else {
			if v == w {
				h = (h - 1 + H) % H
			}
		}
	}
	if (w + h) % 2 == 0 {
		fmt.Printf("white")
	}else {
		fmt.Printf("black")
	}

}
0