Basic DivisonProblem code: A102 |
All submissions for this problem are available.
Here you need to play a board game. The board has N places labeled as 1,2,..N. Each place is marked with either + or -. The position 1 is always marked +.
The playing piece is initially placed at 1. The game undergoes in rounds. In each round a single die is thrown which determines the no of paces to move. However the following rules are to be kept in mind.
1)If the position of the piece is labeled j+ and the dice reads d,such that j+d<=N, then the piece moves forward d steps, otherwise it remains at j.
2)If the position of the piece is labelled j- and the dice shows d,such that j-d>=1,then the piece moves backwards d steps, otherwise it remains at j.
Finally the game is decided on the basis of the score which keeps the count of the number of times the piece reaches position 1.
Input::
The first line should contain 2 integers specifying the number of positions on board an the number of throws from the die. The next lines contain either + or -, depending on the pattern of the board
The next lines that follow,contain a single integer d indicating a valid throw such that 1<=d<=6 indicating the move on the die.
Output:
Single integer indicating the score
Sample::
input
12
10
+
+
-
+
-
-
+
-
-
+
-
-
1
1
2
3
2
6
3
2
6
2
Output
3
| Author: | solas_143 |
| Date Added: | 7-04-2012 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS
Fetching successful submissions


This is very Sad, First the
@Alok- i got a penalty
where is the ranking
@Illusion3 we have considered
@All This is the ranking