Project of Petya and Staircases
Project of Petya and Staircases
(Deemed to be University)
On
SUBMITTED BY:
2200031403 G.MEGHANA
2200031406 P.KALYAN
K.CHIRANJEEVI
Assistant Professor
KL UNIVERSITY
Green fields, Vaddeswaram – 522 302
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES-1
CERTIFICATE
K.Chiranjeevi Dr.D.Haritha
ACKNOWLEDGEMENTS
I express the sincere gratitude to our principal Dr. A. Jagadeesh for his
administration towards our academic growth.
G.Meghana 2200031403
P.Kalyan 2200031406
ABSTRACT
Little boy Petya loves stairs very much. But he is bored from simple going up and down
them — he loves jumping over several stairs at a time. As he stands on some stair, he
can either jump to the next
one or jump over one or two stairs at a time. But some stairs are too dirty and Petya
doesn't want to step on them.Now Petya is on the first stair of the staircase, consisting of
n stairs. He also knows the numbers of the dirty stairs of this staircase. Help Petya find
out if he can jump through the entire staircase and reach the last stair number n without
touching a dirty stair once. One has to note that anyway Petya should step on the first
and last stairs,so if the first or the last stair is dirty, then Petya cannot choose a path with
clean steps only.
INDEX
S.NO TITLE PAGE NO
1 Introduction 1
4 Algorithm 8
5 Flowchart 9-10
6 Implementation 11-12
8 Conclusion 14
INTRODUCTION
Little boy Petya loves stairs very much. But he is bored from simple going up and
down them — he loves jumping over severalstairs at a time. As he stands on some stair,
he can either jump tothe next one or jump over one or two stairs at a time. But some
stairs are too dirty and Petya doesn't want to step on them. Now Petya is on the first
stair of the staircase, consisting of n stairs. He also knows the numbers of the dirty
stairs of this staircase. Help Petya find out if he can jump through the entirestaircase
and reach the last stair number n without touching a
dirty stair once. One has to note that anyway Petya should stepon the first and
last stairs, so if the first or the last stair is dirty, then Petya cannot choose a path with
clean steps only.
AIM
Little boy Petya loves stairs very much. But he is bored fromsimple going up and down
them — he loves jumping over several stairs at a time. As he stands on some stair, he can
either jump tothe next one or jump over one or two stairs at a time. But some stairs are too
dirty and Petya doesn't want to step on them.
Now Petya is on the first stair of the staircase, consisting of n stairs. He also knows the
numbers of the dirty stairs of this staircase. Help Petya find out if he can jump through the
entire staircase and reach the last stair number n without touching a dirty stair once.
One has to note that anyway Petya should stepon the first and
last stairs, so if the first or the last stair is dirty, then Petya cannot choose a path with
clean steps only.
Input The first line contains two integers n and m (1 ≤ n ≤ 109,0 ≤ m ≤ 3000) — the number
of stairs in the staircase and the number of dirty stairs, correspondingly. The second line
containsm different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) —the numbers of the
dirty stairs (in an arbitrary order):
Advantages:-
We can increase our thinking skills and innovation skill.Straight stairs tend to be
the easiest to go upand down, or, ascend/descend, as we say in the industry.
They are typically the easiest to build, however, thisdepends a lot on the
level of detail in the design.
Straight stairs only need to be connected at the top and thebottom (no
intermediate supporting structure is required).
They work well with minimalist designed homes due to theirinherent simplicity.
By selecting thinner treads, open risers, and thin metal stringers, straight stairs can
be made more transparent thanother types of stairs, allowing less obstruction to
the view beyond.
Measuring for railings for straight stairs is simpler than forother stair designs.
Disadvantages:-
Straight stairs use up a fair amount of linear space, whichhas to be planned
for in your design.
Some of the other stair types create a privacy barrier between the floors of
your home. Straight stairs do not offerthis privacy.
A stair 12-feet high requires a landing to break up the span. The addition of a
landing will use up a lot more space and therefore these types of stairs are
seldom used in residentialconstruction. You will see these more frequently in
large commercial buildings.
Future enhancements:-
Stairs aren't only a means of vertical circulation. Through their might and scale, this
building element can easily become the protagonist of a space. From afar one canobserve
the movement of people; from within the staircase the viewer is treated to new angles
and perspectives of the building.
The prominence of staircases in the work of 2001 Pritzker Prize winners Herzog and
de Meuron underscore the belief that risers and treads are never solely an element of
circulation—theyare generators of dynamism and rhythm that influence the essence of
their projects.
Spiral staircases save valuable square meters because they occupya much smaller area than
a conventional staircase. With daring shapes and diverse configurations, they can also be
iconic objects in projects. However, the design of these staircases requires careful attention
so that you can prevent an uncomfortable or dangerous outcome. Although BIM software
simplifies this process, it's always important to understand the restrictions and the
underlying concepts.
This question can be basic and you may know the answer, but it's always good to remember
some elementary calculations that helpus to streamline the design process.
Check the effective formula developed by French architect François Blondel, which
allows you to determine the correct dimensions of a comfortable and efficient
staircase according toits use
SYSTEM REQUIREMENTS
SOFTWARE REQUIREMENTS:
The major software requirements of the project are as
follows: Language : Turbo-C
Operating system: Windows Xp or later.
HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as
follows: RAM : 8 GB
Processor : i5
ALGORITHM
1. start
2. assume k=0,search=0,t,i,j,n,m,a[m]
3. 3.read n,m
4.for(i=0;i<m;i++)Read
a[i] 5.for(i=0;i<m;i++)
If(a[i]==1//a[i]==n)K=1
6.while(1)
search=0
for(i=0;i<m;i++)
if(a[i]>a[i+1])
t=a[i]
a[i]=a[i+1]
a[i+1]=t
search++
if(search==0)break for(i=0;i+2<m;i+
+) if((a[i+2]-
a[i])==2)
k=1
if(k== 1)
print “NO”
else
print “YES”
FLOWCHART
IMPLEMENTATION
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
int
n,m,i,j,k=0,search=0,t;
scanf("%d%d",&n,&m);
int a[m]; for(i=0;i<m;i+
+)
scanf("%d",&a[i]);
for(i=0;i<m;i++)
if(a[i]==1||a[i]==n)
{
k=
1;
while(1)
search=0;
for(i=0;i<m;i++)
if(a[i]>a[i+1])
{
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
search++;
if(search==0)
break;
for(i=0;(i+2)<m;i++)
if((a[i+2]-a[i])==2)
k=1;
if(k==1)
printf("NO");
else
printf("YES"
);
}
RESULTS AND SCREENSHOTS
OUTPUTS
Screen Shots:
CONCLUSION
Here the conlusion is we have to read good steps ten and dirty steps
as 5 and when we given the input as 2 4 8 3 6 The output will be print No. Print "YES" if
Petya can reach stair number n, stepping only on the clean stairs.