Question
A state machine consists of a finite number of states and is therefore also called finite-state machine (FSM). Based on the current state and a
A state machine consists of a finite number of states and is therefore also called finite-state machine (FSM). Based on the current state and a given input or conditions the machine performs state transitions and produces outputs.
For instance, we defines several states to indicate process state in operating system.
Now, I give you a state machine as below. In each testcase, I will give some numbers indicated state transition conditions as input and your initical state is at "Start". Please implement a program output which state is your final state.
Input:
First line contains one integer , indicated how many transition numbers.
Second line contains integers and seperated by space, indicated transition number .
Ensure series follows state machine rule.
Output:
Please output the last state after transition numbers.
Sample input:
5
34 92 8 8 10000
Sample output:
You are in Final.
others Start other . 60,43 34,16 S1 S3 S5 15 30.87 92 others S2 S4 40,56,62 S6 all 1 N 10% . OST2-1 Ensure series T, follows state machine rule. Output Please output the last state after transition numbers. 23,99 Final Input First line contains one integer N, indicated how many transition numbers. Second line contains Nintegers and seperated by space, indicated transition number T. all Sample Input 1 34 92 88 10000 Sample Output 1 You are in Final. Sample Input 2 1 160 15 1 921 92 1 92 1 You are in 55. 3. Submission format ********* hv_w03.zip Lxxxxxxxxx_hw_01.cpp >xxxxxxxxx is your student id.
Step by Step Solution
3.44 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
To implement a program that simulates the state transitions based on the given input numbers you can use Python Heres a simple Python program to achie...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started