結果

問題 No.154 市バス
ユーザー tnoda_tnoda_
提出日時 2015-02-18 16:51:24
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 15,552 ms
コンパイル使用メモリ 243,840 KB
実行使用メモリ 7,888 KB
最終ジャッジ日時 2024-04-21 08:06:45
合計ジャッジ時間 17,968 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func solve() (res string) {
	res = "impossible"
	var S string
	fmt.Scan(&S)
	var W, G, R int
	for _, r := range S {
		switch r {
		case 'W':
			W++
		case 'G':
			if W == 0 {
				return
			}
			W = 0
			G++
		case 'R':
			R++
		}
		if R > G {
			return
		}
	}
	if W == 0 && G == R {
		res = "possible"
	}
	return
}

func main() {
	var N int
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		fmt.Println(solve())
	}
}
0