473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

problems with a question.I'm using c++, don't need the code, just the logic to solve it, thanks!

the natural number is represented by the number of times the pattern "100" appears in the sequence.

For example, in the sequence 11101001010011110 the pattern appears twice and in the sequence 11101010111110111010101 it does not appear at all. You must implement a program that, given the sequence of zeros and ones, calculates how many times the pattern "100" appears in it.

Input
The first line of the input contains an integer NN, the length of the string. The second line contains the sequence of NN zeros and ones, separated by white space.

Exit
Your program must print an integer, how many times the pattern "100" appears in the sequence.
Jun 5 '21 #1
1 2868
dev7060
636 Expert 512MB
problems with a question.I'm using c++, don't need the code, just the logic to solve it, thanks!
What is your first thought and understanding of the question?
Jun 6 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Barry Munro | last post by:
Hi, I'm using the following code to print documents from the file system but i'm encountering strange behaviour. If I print one document it works ok but if i say loop round a list of files and...
0
by: Traci | last post by:
I have a summary form that has two columns of unbound textboxes for actual cost and marked up price. There are eight textboxes in each column. There are also two unbound subforms. Each set of...
2
by: Krzysztof Bartosiewicz | last post by:
Hi! I have problems with editing my VBA code. It is connected with some kind of automatic-correction mechanism in Access which I cannot find. I turned off Automatic Syntax Check in Options menu...
7
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
6
by: Norton | last post by:
When i try to use OleDbDataAdapter's QueryBuilder, when i type some SQL Statement "Select Top X .....", it works and display the correct result, however i cannot generate the select statement...
18
by: __PPS__ | last post by:
Hello, I'm a university student and I'm preparing for my final today. I'm reading course notes, I found completely strange piece of code. It makes me laugh, I think the teacher needs to prepare...
0
by: BM | last post by:
Hi, I' using ASP.net 2.0. I have 2 design pages, which are the same, but in 2 languages. Is it possible to use only one code-behind page for both these pages bcoz, the code and logic and...
5
by: SM | last post by:
Hello I have simple question using simpleXML and PHP. i have an xml file that looks like this: <?xml version="1.0" encoding="UTF-8"?> <discography version="0.01"> <CD>...
0
by: manikandan | last post by:
dont miss it just open dont miss it just open dont miss it just open #############################
13
by: CD Tom | last post by:
I've been fighting this outlook problem and have finally figured out why the reference is missing when a person doesn't have outlook installed. I have Office 365 on my development machine, and this...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.