結果

問題 No.291 黒い文字列
ユーザー warashiwarashi
提出日時 2015-10-16 22:58:48
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 11,979 ms
コンパイル使用メモリ 226,324 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 03:25:27
合計ジャッジ時間 13,650 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var S string
	var count int
	var state = 'I'
	fmt.Scanln(&S)
	for _, r := range S {
		switch state {
		case 'K':
			if r == 'U' || r == '?' {
				state = 'U'
			}
		case 'U':
			if r == 'R' || r == '?' {
				state = 'R'
			}
		case 'R':
			if r == 'O' || r == '?' {
				state = 'O'
			}
		case 'O':
			if r == 'I' || r == '?' {
				state = 'I'
				count++
			}
		case 'I':
			if r == 'K' || r == '?' {
				state = 'K'
			}
		}
	}
	fmt.Println(count)
}
0