Consider you have a piece of paper with you. Fold the paper upwards such that the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider you have a piece of paper with you. Fold the paper upwards such that the bottom edge meets the top edge. Once you do this, a horizontal crease is created at the center of the paper which bends downwards (call it a trough). Next, fold the paper again upwards. Now you get more folds in the paper (this time bending upwards too, call these crests). Keep repeating this as many times as you like. When you unfold the paper completely, you will have a series of creases (crests and troughs). Let us say you folded the paper N times. The resulting sequence of crests and troughs is called the paper-folding sequence. For example, N=1: the sequence is 1. N=2: the sequence is 110, and so on, where 0 denotes a crest and 1 denotes a trough. Given N, find the paper- folding sequence corresponding to it. Input: The first and only line of input contains a single integer – N (1 5 N< 24) (the number of folds) Output: For each test case, print the sequence corresponding to N folds. Example: Sample Input 0: 1 Sample Output 0: Sample Input 1: Sample Output 1: 110 Consider you have a piece of paper with you. Fold the paper upwards such that the bottom edge meets the top edge. Once you do this, a horizontal crease is created at the center of the paper which bends downwards (call it a trough). Next, fold the paper again upwards. Now you get more folds in the paper (this time bending upwards too, call these crests). Keep repeating this as many times as you like. When you unfold the paper completely, you will have a series of creases (crests and troughs). Let us say you folded the paper N times. The resulting sequence of crests and troughs is called the paper-folding sequence. For example, N=1: the sequence is 1. N=2: the sequence is 110, and so on, where 0 denotes a crest and 1 denotes a trough. Given N, find the paper- folding sequence corresponding to it. Input: The first and only line of input contains a single integer – N (1 5 N< 24) (the number of folds) Output: For each test case, print the sequence corresponding to N folds. Example: Sample Input 0: 1 Sample Output 0: Sample Input 1: Sample Output 1: 110
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Before beginning the assignment, take a moment to look through the papers in this module. Note in the lower left-hand corner that some documents are audit work papers created by Garcia and Foster...
-
You have a piece of gold jewelry weighing 9.35 g. Its volume is 0.654 cm3. Assume that the metal is an alloy (mixture) of gold and silver, which have densities of 19.3 g/cm3 and 10.5 g/cm3,...
-
The thickness of a piece of paper is 0.0036 in. Suppose a certain book has an Avogadro's number of pages; calculate the thickness of the book in lightyears.
-
Ms. Acosta received a job as a teacher with a starting salary of $3 According to her contract, she will receive a 1.5% increase in her salary every year. How much will Ms. Acosta earn in 7 years.
-
A meteorologist in Chicago recorded the number of days of rain during a 30-day period. If the random variable x is defined as the number of days of rain, does x have a binomial distribution? If not,...
-
For the following data: a. Find the regression equation for predicting Y from X. b. Calculate the Pearson correlation for these data. Use r2 and SSY to compute SSresidual and the standard error of...
-
Discuss the importance of reporting births and deaths.
-
A liquid mixture containing 40.0 mole% methanol and 60.0 mole% 1-propanol is placed in an open vessel and heated slowly. Estimate the temperature at which the mixture begins to boil. List assumptions...
-
Cherokee Incorporated is a merchandiser that provided the following information: Number of units sold Selling price per unit Variable selling expense per unit Variable administrative expense per unit...
-
On January 1, 2024, the general ledger of Dynamite Fireworks includes the following account balances: Accounts Cash Accounts Receivable Supplies Land Accounts Payable Common Stock Retained Earnings...
-
Nikki loves to collect accessories, namely boots (good x) and hats (good y). Her preferences over bundles (r, y) containing boots and hats can be represented by u(x, y) = a"y-", where 1 > a > 0. The...
-
Find the requested probabilities in Problems 11-14. \(P(C)\) if \(P(\bar{C})=\frac{9}{13}\)
-
What is the birthday problem?
-
Suppose a pair of dice are rolled. Consider the sum of the numbers on the top of the dice and find the probabilities. a. 8 , given that a double was rolled b. a double, given that an 8 was rolled
-
What do we mean by " 100 -year storms" or a "1,000-year earthquake"? How do these expressions relate to probability?
-
The one coin payoffs for the slot machine shown in Problem 37 are as follows: What is the mathematical expectation for playing the game with the coin being a dollar? Assume the three wheels are...
-
Explain the advantages and disadvantages of budgetary control (i.e. cash budget, fixed budget, and flexible budget).
-
Which of the ocean zones shown would be home to each of the following organisms: lobster, coral, mussel, porpoise, and dragonfish? For those organisms you identify as living in the pelagic...
-
When two beakers containing different concentrations of a solute in water are placed in a closed cabinet for a time, one beaker gains solvent and the other loses it, so that the concentrations of...
-
Write electron-dot formulas for the following: a. SeOCl2 b. CSe2 c. GaCl4 d. C22
-
Write equations for the equilibria involving carbon dioxide in water.
-
Suppose that in September 2013 a company takes a long position in a contract on May 2014 crude oil futures. It closes out its position in March 2014. The futures price (per barrel) is \($88.30\) when...
-
Explain how the control variate technique is implemented.
-
A company wishes to hedge its exposure to a new fuel whose price changes have a 0.6 correlation with gasoline futures price changes. The company will lose $1 million for each 1 cent increase in the...
Study smarter with the SolutionInn App