+ 2

Pls Can someone help me and solve this? using java, python or #C

Let's play dice! The traditional die is a cube. Each of its six faces shows a different number of dots from 1 to 6. Dice are used to produce results from 1 through 6. When a die is thrown (or rolled) and the die comes to rest, the face of the die that is uppermost provides the value of the throw. If an unbiased die is thrown, each value from 1 to 6 is equally likely. Your programming task is related to the analysis of sequences produced by rolling a die. Create a program named Dice to solve the following two exercises. The input of the program is a so-called trial, i.e. a sequence of the rolled results. First, your program has to ask the user for an integer N, indicating the number of throws , the length of the triel. Then, N number of throws has to be asked, each throw result is a digit from 1 to 6. Your program is expected to print out the solution for 2 exercises. You are allowed to ask the input and print out the output in any form of your choice. For example, you can read N number of throwns one by o

22nd Oct 2019, 4:35 PM
Iniobong Akpan
2 Antworten
+ 5
Exercises Exercise 1 How many times did it occur in the trial, that exactly two 6s were rolled after each other? For example, in sequence 56611166626634416 it occurred twice, that exactly two 6s were thrown after each other. Exercise 2 Find the length of the longest subsequence of successive rolls, in which the value 6 does not occur. (This number can be zero, if only 6s were thrown.) For example, in the trial 66423612345654 the longest subsequence of successive rolls in which the value 6 does not occur is 12345. Its length is 5.   -------------------------------------------------------------------------------- Examples We provide three simple examples to clarify the exercises. Test your solution with other, larger examples as well! Example 1 Sample input: 9 616161666 Sample output: 0 1 Example 2 Sample input: 18 456116513656124566 Sample output: 1 4 Example 3 Sample input: 17 56611166626634416 Sample output: 2 4  
22nd Oct 2019, 4:36 PM
Iniobong Akpan