1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
finlep [7]
3 years ago
6

Let S(n) be the number of binary strings of length n that avoid the substring 111 meaning there are no 3 consecutive bits that a

re all 1. For example, if n=5 then 01101 avoids the substring 111 but 01110 does not avoid the substring 111. Compute T(0), T(1), T(2), T(3), T(4) by writing down all the strings.

Computers and Technology
1 answer:
il63 [147K]3 years ago
7 0

Answer:

Please see attachment

Explanation:

Please see attachment

You might be interested in
Monster Collector
Lera25 [3.4K]

Answer:

In java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int monsternum, usernum;

 int count = 0;

 Random rand = new Random();

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

 for(int i =0;i<2;i++){

     monsternum = rand.nextInt(5);  

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

     usernum = input.nextInt();

     if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  }

 else{      System.out.println("You almost had it, but the monster escaped.");  }

 

 }

 System.out.println("There are no more monsters to encounter!");

 System.out.println("You caught "+count+" monsters of 2");

 if(count!=2){      System.out.print("Keep training to be the very best!");  }

 else{      System.out.print("You're the monster collector master!");  }

}

}

Explanation:

This declares monster and user number as integers

 int monsternum, usernum;

Initialize count to 0

 int count = 0;

Call the random object

 Random rand = new Random();

Create a string array to save the monster names

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

Iterate for the 2 monsters

 for(int i =0;i<2;i++){

Generate a monster number

     monsternum = rand.nextInt(5);  

Prompt the user to take a guess

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

Get user guess

     usernum = input.nextInt();

If monster number and user guess are equal, congratulate the user and increase count by 1

<em>      if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  } </em>

If otherwise, prompt the user to keep trying

<em>  else{      System.out.println("You almost had it, but the monster escaped.");  }  </em>

<em>  } </em>

Print no monsters again

 System.out.println("There are no more monsters to encounter!");

Print number of monsters caught

 System.out.println("You caught "+count+" monsters of 2");

Print user score

<em>  if(count!=2){      System.out.print("Keep training to be the very best!");  } </em>

<em>  else{      System.out.print("You're the monster collector master!");  } </em>

5 0
3 years ago
After a file downloads, you can do any of the following except
loris [4]
Change owner rights... I think you forgot to put the choices, I am taking a wild guess of what the answers could have been.
8 0
3 years ago
Write an expression that evaluates to true if and only if the string variable s does not equal the string literal end.
Marysya12 [62]
Which language is this in?

For Java,

if (s.equals("end"))
    return true;
7 0
3 years ago
Identify the correctly constructed ALTER TABLE statement to add a UNIQUE constraint to the column customer_number with the const
SVEN [57.7K]

ALTER TABLE customer ADD CONSTRAINT customer_number_unique UNIQUE (customer_number);

5 0
2 years ago
The following code is intended to calculate the sum of the first five positive odd integers. int sum = 0, k; for (k = 1; k &lt;=
goldfiish [28.3K]
Calculate the sum of the first 5 positive odd integers: Let's do this in our head first, so we can check if our code is right or not!

The first positive 5 odd integers are: 1, 3, 5, 7, 9
Sum these to: 25

int sum = 0, k; <------These just declare our variables, telling the program 'Hey, I'm going to use 'sum' and 'k' to store data.

for (k = 1; <---We're going to repeat the following code, and we're starting at 1
k <= 10; <---- We're going to continue to repeat until we greater than 10.
k += 2) <------ Every time we do a loop, we're going to add 2.

{ sum += k; } <---- We're going to increase the number inside "sum" by the number inside "k"

Let's run this and see what happens. Remember, we keep going until we hit more than 10.

Round 0: k = nothing, sum = 0 (before we start the loop)
Round 1: k = 1, sum = 1
Round 2: k = 3, sum = 1+3 or 4
Round 3: k = 5, sum = 4 + 5 or 9
Round 4: k = 7, sum = 9 + 7 = 16
Round 5: k = 9, sum = 16 + 9 = 25
Round 6: k = 11, sum = 25 + 11 = 36

Well, we can tell here that round 5 was correct, but round 6 is not correct. And our loop condition says <=10, which means we have to do Round 6.

This means we did it one too many times. Our ending condition should be <10, instead of <=10. 

Option B


5 0
3 years ago
Other questions:
  • A financial consulting firm recently recovered from some damaging incidents that were associated with malware installed via root
    6·1 answer
  • Mateo could not find the undo command or shortcut. He should _____.
    15·2 answers
  • Given the following code fragment, how many times does the loop body execute? int laps = 50; int myNum = 1; do { myNum = myNum +
    9·1 answer
  • Which of the following is an electronic device, operating under the control of instructions stored in its own memory, that can a
    6·1 answer
  • Write only in C, not C++.
    14·1 answer
  • Bullet points on a slide should be limited to _____.<br><br> A. 2<br> B. 4<br> C. 8<br> D. 10
    7·1 answer
  • What is the promotion and advertising stage of a product or service called?
    15·1 answer
  • Hide Time Remaining A
    11·1 answer
  • This is used to copy information from cell to cell in the spread sheet
    7·1 answer
  • How to make a computer
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!