QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 64 MB Total points: 100

#23748. 骰子

Statistics

一顆骰子按下圖所示的朝向放置。

problem_23748_304c8f4f0d7bcdf755f610a4d1534eee.png

這裡所使用的骰子如該圖所示,當上方為 $1$、南側為 $2$ 時,東側為 $3$。由於骰子相對兩面的點數總和總是 $7$,因此看不見的面分別為北側 $5$、西側 $4$、下方 $6$。

從這個初始配置狀態開始,按照指示移動骰子。其中,指示是若干次執行以下 $6$ 種操作。

problem_23748_72d8c824c4b7e7b2153bcc762586c844.png problem_23748_351ae00444f5f85272c6e0b480784775.png problem_23748_c14159840b38cefaa3541522e15482ec.png problem_23748_348dec7a597c22f23bab6e9c675aeeca.png
problem_23748_593a588389d24d87834e078753aa4bfd.png problem_23748_d77964fb3dfcacbf2a397262f4d096a7.png

North、East、South、West 各操作將骰子向所指示的方向旋轉 $90$ 度。

Right、Left 這 $2$ 種操作保持上下面不變,在水平方向上旋轉 $90$ 度。(請特別注意旋轉方向。)

將初始配置中頂面朝上的點數 $1$ 作為初始值,每完成 $1$ 次操作,就加上此時頂面朝上的點數,請撰寫一個程式,輸出按照指示完成所有操作後的總和。

輸入檔案的第 $1$ 列寫有總指示次數 $n$,接下來的 $n$ 列每列寫有「North、East、South、West、Right、Left」中的某 $1$ 個指示。其中 $n \le 10000$。

在上傳的輸出檔案中,請在輸出(總和)之後加入換行。

範例

輸入格式 1

5
North
North
East
South
West

輸出格式 1

21

輸入格式 2

8
West
North
Left
South
Right
North
Left
East

輸出格式 2

34

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.