Professional Documents
Culture Documents
On
SUBMITTED BY:
2000031022 T.ASRITH
2000031029 P.UDAYSAI
Dr . Y.AYYAPPA
Associate Professor
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES
CERTIFICATE
ACKNOWLEDGEMENTS
It is great pleasure for me to express my gratitude to our honorable President Sri.
Koneru Satyanarayana, for giving the opportunity and platform with facilities in
accomplishing the project based laboratory report.
I express sincere gratitude to our Coordinator and HOD-BES Dr. D.Haritha for her
leadership and constant motivation provided in successful completion of our academic
semester. I record it as my privilege to deeply thank for providing us the efficient faculty
and facilities to make our ideas into reality.
I express my sincere thanks to our project supervisor <name> for his/her novel
association of ideas, encouragement, appreciation and intellectual zeal which motivated
us to venture this project successfully.
NAME ID NUMBER:
T.ASRITH 2000031022
P.UDAYSAI 2000031029
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.
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 contains m
different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in
an arbitrary order).
Output
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print
"NO".
Examples
input
10 5
24836
output
NO
input
10 5
24579
output
YES
INDEX
S.NO TITLE PAGE NO
1 Introduction <1-4>
5 Implementation <9-10>
8 Conclusion <12>
INTRODUCTION
Each variable in C has an associated data type. Each data type requires
different amounts of memory and has some specific operations which
can be performed over it. Let us briefly describe them one by one:
Following are the examples of some very common data types used in C:
• int: As the name suggests, an int variable is used to store an
integer.
We use “&” symbol because The ampersand (&) allows us to pass the
address of variable number which is the place in memory
where we store the information that scanf read.
9. int cont=0;
int flag=1;
AIM
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.
SYSTEM REQUIREMENTS
➢ SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : c
Operating system: Windows Xp or later.
➢ HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as follows:
RAM :
Processor : i7
DATA FLOW DIAGRAM
start
Now
scanf("%d",
&i)
yes no If no
printf(" If yes if(flag==1)
YES\n") then int Printf as no
; cont=0;
int printf("NO\n")
flag=1; ;
Use return 0
for(int stop
i=2;i<m;i
++)
ALGORITHM
Step 1: start
Step 2: read stdio.h
Step 3:now int n,m,a[0]
Step 4:now scan the n,m values
Step 5:now print those values
Step 6:use if else statement for if yes or no
Step 7:if yes int cont=0;
int flag=1;
for(int i=2;i<m;i++)
{
if(a[i]-a[i-2]<=2)
{
printf("YES\n");
flag=0;
Step 8:if no if(flag==1)
printf("NO\n");
Step 9: stop
IMPLEMENTATION
//PETYA AND STAIRCASES
#include<stdio.h>
int main()
int n,m,a[0];
while(scanf("%d %d",&n,&m));
scanf("%d",&i);
if(m>=n)
printf("YES\n");
else
if(a[0]==1||a[m-1]==n)
printf("YES\n");
else
{
int cont=0;
int flag=1;
for(int i=2;i<m;i++)
if(a[i]-a[i-2]<=2)
printf("YES\n");
flag=0;
break;
if(flag==1)
printf("NO\n");
return 0;
}
INTEGRATION AND SYSTEM TESTING
OUTPUTS
Screen Shots:
CONCLUSION
WE PROVED THAT: 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.