-->
当前位置:首页 > 题库

PROGRAMMING:Archives of previous life

Luz5年前 (2021-05-10)题库409
![ qs.jpg](~/2ab62885-0642-4a48-b41d-94e4e30d7246.jpg)
This kind of funny fortune teller is often encountered in the network world. The implementation principle is very simple. Design a few questions randomly, and choose a path in the judgment tree according to the player's answer to each question (as shown in the figure below). The conclusion is the node corresponding to the end of the path.
![ path.jpg](~/822292db-6097-418b-a245-02e4a2473560.jpg)
Now let's number the conclusions from left to right, starting with 1. Here we assume that the answers are simple "yes" or "no", and that "yes" corresponds to the path to the left, while "no" corresponds to the path to the right. Given a series of answers from the player, please return the number of the conclusion.
###Input format:
Enter two positive integers in the first line: $$n $$($$Le 30 $$) the number of questions to be answered in a test for the player$$ M $$($$Le 100 $$) is the number of players.
The next $$M $$line gives the player's $$n $$answers in turn. Here, y stands for "yes" and N stands for "no".
###Output format:
For each player, output the number of the corresponding conclusion in a line.
###Input example:
```in
3 4
yny
nyy
nyn
yyn
```
###Output example:
```out
three
five
six
two
```







answer:If there is no answer, please comment