QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 64 MB مجموع النقاط: 100

#23748. 問題3

الإحصائيات

 サイコロが以下の図のような向きで置かれている.
 
 ここで使用するサイコロは, この図のように, 上側に 1,南側に 2 があるときは,東側に 3 があるものとする. サイコロの向かいあう面の和は必ず 7 なので, 見えない面はそれぞれ北側 5, 西側 4,下側 6 になっている.

 この初期配置の状態から指示に従ってサイコロを動かしていく. ただし, 指示は以下の 6 通りの操作を何回か行うものである.
   

  
 North,East,South,West の各操作は指示された方向へサイコロを 90 度回転させる.
 Right,Left の 2 つの操作は上下の面はそのままで水平方向に 90 度回転させる. (回転させる向きに要注意.)

 初期配置で上の面に出ている目 1 を初期値とし, 1 回の操作が終わるたびに, 上の面に出ている目の数を加算していき, 指示にしたがってすべての操作を終えたときの合計値を出力するプログラムを作成しなさい.

 入力ファイルの 1 行目には総指示回数 n が書かれていて, 続く n 行の各行には 「North,East,South,West,Right,Left」 のいずれか 1 つの指示が書かれているものとする. ただし, n ≦ 10000 とする.

 アップロードする出力ファイルにおいては, 出力(合計値)の後に改行を入れること.

入力例1 入力例2
5 8
North West
North North
East Left
South South
West Right
North
Left
East
 
出力例1 出力例2
21 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.