結果

問題 No.2926 Botaoshi
コンテスト
ユーザー ID 21712
提出日時 2024-11-02 17:58:34
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 377 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,288 ms
コンパイル使用メモリ 294,612 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-06 01:55:53
合計ジャッジ時間 15,958 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import . "fmt"

func main() {
	var n int
	var s string
	Scan(&n,&s)
	const m=998244353
	var lc,rc,uc int64
	uc=1
	for _,x:=range s {
		switch x {
			case 'L':
			lc,rc,uc=lc+uc,0,0
			case 'R':
			lc,rc,uc=0,lc+rc+uc,0
			case 'U':
			lc,rc,uc=0,0,lc+rc+uc
			case '.':
			lc,rc,uc=lc+uc,lc+rc+uc,lc+rc+uc
		}
		lc,rc,uc=lc%m,rc%m,uc%m
	}
	Println((lc+rc+uc)%m)
}
0