First Year ELAB Level 1 (I) (2021) - SRMnotesADDA
First Year ELAB Level 1 (I) (2021) - SRMnotesADDA
Download the Brave browser for copying the code into your Elab click on the button to
download the browser.
Download
If you want us to help you more, please consider subscribing our youtube channel. It would
mean a lot to us and it will show us that you want us to help you more.
Subscribe!!
Table of Contents
1. Nathan works as an HR in a private company.
2. Tina’s trainer have given her two positive integers U and V.
3. Rathik organized technical round interview in Macrosoft for the set of computer science
candidates.
4. Elavenil runs a popular bakery in his native.
5. Nancy bought apples in a fruit shop.
6. The employees of one million dollar profit company TeamZilla organised the strike because
they want to have additional salary increment, the strike is continuing for more than a month
now.
7. Selvan was playing with the a object of random size for stress relief.
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 1/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
8. On one beautiful Sunday Selvan went to Aaron’s house for exam preparation.
9. Professor JD has lots of options.
10. Laasya bought a new volleyball in the sports shop. It looks like a medium size.
11. Abi and Jannu are off to the wedding of a close relative.
12. Three brothers want to take a photo with family members.
13. There are two monkeys on an x-axis ready to jump in the positive direction
14. Swathi is working in a world famous pizza restaurant.
15. Agathiyan is the Chief In charge for carrying out World Economic Survey in India.
16. Sivan’s is teaching his son Vigneshwaran his daily lessons in their home.
17. Rohit has ‘A’ Chocolates and Mohit has ‘B’ Chocolates.
18. Thane wants to print a document with “N” pages double sided, where two pages of data can
be printed on one sheet of paper.
19. Selvan is working as a QC in a reputed Multinational Conglmerate.
20. Anegan is a member of a programming competition site, Awesome Coder.
21. The Matriculation school have arranged an Annual Day Function.
22. Mahesh has given a two-dimensional 3*3 array starting from A [0][0].
23. The much-anticipated video game “PUBG” has been released. The rules of “PUBG” are very
simple.
24. After completing some serious investigation, Arif and Simon are now chilling themselves in
the Ooty hills.
25. Let’s consider a triangle of numbers in which one number appears in the first line, two
numbers appear in the second line, three in the third line, etc.
26. Laaysa with his friends going the theatre for a movie.
27. Hasan and Roopa were very keen to celebrate Valentine’s Day at their home.
28. Mr. Arulmazhivalman loves programming and he likes to face new programming challenges
29. Today is Caleb’s birthday. His dad has surprised him with truly fruity gifts: 2 fruit baskets.
30. Joslyn likes problems involving arrays.
31. Lokesh usually likes to play cricket, but now, he is bored of playing it too much, so he is
trying new games with strings.
32. Afghanistan has surrounded by attackers. A truck enters the city.
33. Hassan is given a string containing characters A and B only.
34. Lokesh have been given a String S consisting of uppercase and lowercase English
alphabets.
35. Roopa has given a program to her close friend Jhansi in the apartment where she lives
36. Not everyone probably knows that Nivin has younder brother Nithin. Currently Nithin learns
to read.
37. Elavenil likes strings a lot but she likes palindromic strings even more.
38. Mohit has no work to do in the kitchen, so he decided to play a card game with the following
rules:
39. Jeferson was given a strings of length 8 consisting solely of ‘O’s and ‘1’s.
40. Nathan wants to implement wildcard pattern matching supporting only the wildcard ‘?’.
41. Simon celebrates his 25th birthday.
42. Darsh seemingly down-to-earth guy.
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 2/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
81. The Gang of Friends went to one of their friend’s sangeet function were they planned to
dance as a pair.
82. A Zoo consists of a lion museum and a zoo for safari riding.
83. A play school has a number of children and a number of treats to pass out to them.
84. Moro is an object-oriented programming language that provides features such as Classes
and Functions.
85. Dharma and Tina has recently decided to learn about developing compilers.
86. Pathan likes solving Rubik’s cube a lot.
87. Two lions and a hyena are at various positions on a line.
88. Shah is an road side cloth seller.
89. Sundar is well known for setting typical problems for the contest.
90. Since Festember is a contest of teams with up to two members, everyone is looking for a
teammate
91. Arun runs a small hotel near the popular university.
92. It is a winter super sale and all the shops have various offers.
93. Araov was given a problem to solve, by his brother Dharma.
94. Rohan wanted to distribute ‘N’ Dragon Fruits among people according to the following
condition
95. Fahad’s Birthday is a week ahead.
96. Consider an analog clock whose hour and minute hands are A and B centimeters long,
respectively.
97. Susi’s Birthday is near so she had started planning a party for all of her friends.
98. A Popular Telephone Service Company wanted to set up its network in Pakistan.
99. Imagine the field is a 2D plane. Each cell is either water ‘W’ or a tree ‘T’.
100. Given a chess board having AXA cells, you need to place A queens on the board in such a
way that no queen attacks any other queen,
#include
int main()
float var1,var2,res;
scanf("%f %F",&var1,&var2);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 4/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
//calculating sum
res=var1+var2;
printf("%.3f",res)
; return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 5/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
#include
int main()
// if ((U%2==0)||(V%2==0)) s=U*V/2;
// else
s=U*V/2+((U%2)*(V%2));
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 6/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
s U / ((U% ) ( % ));
printf("%d",s);
return 0;
Rathik organized technical round interview in Macrosoft for the set of computer
science candidates.
#include
int main()
scanf("%d",&testnum2);
sum=testnum1+testnum2;
sub=testnum1-testnum2;
div=(float)testnum1/(float)testnum2;
mult=testnum1*testnum2;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 7/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
mod=testnum1%testnum2;
return 0;
#include
int main()
{ int n;
scanf("%d",&n);
printf("%d",(n/2)+1);return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 8/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
int main()
a=billamt/amtgiven;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 9/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
a=billamt/amtgiven;
b=billamt%amtgiven;
printf("\nQuotient:%d",a);
printf("\nRemainder:%d",b);
return 0;
The employees of one million dollar profit company TeamZilla organised the strike
because they want to have additional salary increment, the strike is continuing for
more than a month now.
#include
int main()
scanf("%c",&Asc);
printf("%d",Asc);
return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 10/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
Selvan was playing with the a object of random size for stress relief.
#include
int main()
surfacearea=2*(width*length+length*height+height*width);
printf("%d\n",surfacearea);
return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 11/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
On one beautiful Sunday Selvan went to Aaron's house for exam preparation.
#include
int main()
scanf("%f%f",&num1,&num2);
resnum1=num1;
resnum2=num2;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 12/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
;
printf("%lf\n%lf",resnum1,resnum2);
return 0;
#include
#include
int main()
float b,ls,rs1,rs2;
scanf("%f %f",&b,&ls);
b=b*b;
ls=ls*ls;
rs1=sqrt(ls-b);
rs2=sqrt(ls+b);
Laasya bought a new volleyball in the sports shop. It looks like a medium size.
#include
#include
int main()
float radiusofball,volumeofball;
scanf("%f",&radiusofball);
volumeofball=(4/3)*3.14*pow(radiusofball,3);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 13/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
printf("%f",volumeofball);
return 0;
#include
int main()
int n;
scanf("%d",&n);
if(n%8==1)
printf("%dLB",n+3);
printf("%dMB",n+3);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 14/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
printf("%dUB",n+3);
printf("%dSU",n+1);
printf("%dSL",n-1);
printf("%dLB",n-3);
printf("%dMB",n-3);
printf("%dUB",n-3);
#include
int main()
tallest=bro2;
else
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 15/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
tallest=bro3;
printf("%d",tallest);
return 0;
There are two monkeys on an x-axis ready to jump in the positive direction
#include
int main()
int m=x1,n=x2;
if(x2>x1
)
{if (v2>v1){
printf("NO");
}
else {
m=m+v1;
n=n+v2;
if(m==n){
printf("YES");
break;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 16/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
}
}
if (m!=n)
printf("NO");
}
}
return 0;
Click here!
#include
#include
int main()
if(angle1+angle2+angle3==180)
else
return 0;
Agathiyan is the Chief In charge for carrying out World Economic Survey in India.
#include
#include
int main()
int N;
scanf("%d",&N);
if(N<10)
else
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 18/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
return 0;
Sivan's is teaching his son Vigneshwaran his daily lessons in their home.
#include
int main()
sumofangles=angle1+angle2+angle3;
if(sumofangles==180)
else
return 0;
#include
int main()
if(A>=K)
return 0;
Thane wants to print a document with "N" pages double sided, where two pages of
data can be printed on one sheet of paper.
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 20/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int main()
n=N/2;
if(N%2==0)
printf("%d",n);
else
printf("%d",n+1);
return 0;
#include
#include
int main()
scanf("%c",&ch);
if((ch >= 'a' && ch <='z')||(ch >= 'A' && ch <='Z'))
printf("ALPHABET");
else
return 0;
#include
int main()
int n,r;
scanf("%d %d",&n,&r);
if(n>=10) printf("%d",r);
else
printf("%d",r+(100*(10-n)));
return 0;}
#include
int main()
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=i;j++)
{
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 22/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
else
printf("\n");}
return 0;
#include
int main()
{int A[3][3];
int i,j;
for( i=0;i<3;i++){
for(j=0;j<3;j++){
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 23/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int s1=0,s2=0;
for (i=0;i<3;i++){
if((i+j)%2==0){
s1=s1+A[i][j]; }
printf("%d\n%d",s1,s2);
The much-anticipated video game "PUBG" has been released. The rules of "PUBG"
are very simple.
#include
int main()
grid[100][50],coins[50];
{if(i==j)
grid[i][j]=1;
else
grid[i][j]=grid[i-1][j-1]+grid[i-1][j];
}}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 24/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%d",&t);
moves=0;
while(g>0){
row=col;
row++;
g=g-grid[row][col];
coins[moves] =grid[row][col];
moves++; col–;}
printf("%d\n", moves);
for(i=0;i<moves; i++)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 25/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
After completing some serious investigation, Arif and Simon are now chilling
themselves in the Ooty hills.
#include
int main()
{ int t,n,h,i,l=1,count;
scanf("%d",&t);
while(t–)
{l=1;
count=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&h);
if(h==l)
{
count+=2;
}
if(h>l)
{
l=h;
count++;}}
printf("%d\n",count);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 26/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
}return 0;}
Let's consider a triangle of numbers in which one number appears in the first line,
two numbers appear in the second line, three in the third line, etc.
#include
int main()
int i,n,j,t;
scanf("%d",&t);
while(t–)
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<=i;j++){
scanf("%d",&ar[i][j]);
scanf("\n");}
}
for(i=n-1;i>=1;i–)
{
for(j=0;j<i;j++)
{
if(ar[i][j]>ar[i][j+1])ar[i-1][j]+=ar[i][j];
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 27/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
}
}
printf("%d\n",ar[0][0]);
return 0;
#include
int main()
{int t,i,j,c;
scanf("%d",&t);
for(i=1;i<=t;i++){
if(i%2==0)
c=2;
else
c=1;
for(j=1;j<=i;j++){
c+=2;
}printf("\n");
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 28/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
Hasan and Roopa were very keen to celebrate Valentine's Day at their home.
#include
int main()
scanf("%d",&t);
while(t!=0)
{
scanf("%d",&n);
int i;
scanf("%d",&x[i]);
for(i=0;i<n;i++)
scanf("%d",&y[i]);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 29/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{
sum1=sum1+x[i]+y[i+1];
sum2=sum2+y[i]+x[i+1];
}
if(sum1<sum2)
printf("%d",sum1);
else
printf("%d",sum2);
t–;
}
return 0;
#include
int main()
scanf("%d",&Size);
for(i=0;i<Size;i++)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 30/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{scanf("%d",&FreqArr[i]);}
for(i=0;i<Size;i++){c=1;
if(FreqArr[i]==FreqArr[j])
c++;}
if (m<c)
{m=c;
e=FreqArr[i];}}
printf("%d",e);
Today is Caleb's birthday. His dad has surprised him with truly fruity gifts: 2 fruit
baskets.
Code : Miru2021
#include
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 31/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{int t,n,m,k;
scanf("%d",&t);
while(t>0)
{ scanf("%d %d %d",&n,&m,&k);
while(k>0)
{ if(n>m)
{m++;}
else if(m>n)
{n++;}
k–;}
printf("%d\n",(n-m));
t–;}return 0;}
#include
int main()
for(i=0;i<n;i++)
scanf("%d",&matprob[i]);
for(i=0;i<n;i++) {
{ sum=0,mult=1;
for(k=i;k<=j;k++)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 32/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( j )
Lokesh usually likes to play cricket, but now, he is bored of playing it too much, so
he is trying new games with strings.
#include
int main()
int t; int i;
scanf("%d",&t); while(t–)
int n,a=0,b=0;
scanf("%d\n",&n);
char s[100],r[100];
scanf("%s%s",s,r);
for( i=0;i<n;i++)
a+=s[i];
for( i=0;i<n;i++)
b+=r[i];
if(a==b)
printf("YES\n");
else
printf("NO\n"); }
return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 33/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
}
#include
int main()
{int n=0,c=0;
char tag[9];
scanf("%s",tag);
while(n<8){
if(tag[n+1]=='-')
n+=2;
c++;
n++;}
if(c>=4)printf("Allowed");
else printf("Arrest");
return 0; }
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 34/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
#include
int main()
{ char s[100001];
int t,count=0,i;
scanf("%d",&t);
while(t!=0)
{scanf("%s",s);
for(i=0;i<strlen(s);i++)
{if(s[i]==s[i+1])
count++; }
Lokesh have been given a String S consisting of uppercase and lowercase English
alphabets.
#include
#include
int main()
{int i;
char ch[100];
scanf("%s",ch);
for(i=0;i<=strlen(ch);i++){
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 35/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
ch[i]=ch[i]-32;
ch[i]=ch[i]+32; }
Roopa has given a program to her close friend Jhansi in the apartment where she
lives
#include
#include
int main()
{ const char *a[]={ "zero" , "one" , "two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" };
const char *b[]={ "ten" , "eleven" , "twelve" , "thirteen" , "fourteen" , "fifteen" , "sixteen" ,
"seventeen" , "eighteen" , "nineteen" };
const char *c[]={ " " , " " , "twenty" , "thirty" , "forty" , "fifty" , "sixty" , "seventy" , "eighty" , "ninety"
};
scanf("%s",num);
l=strlen(num);
if(l==4)
break; }
{ n=num[1]-48;
if(l==1)
break;
}
{ n=num[3]-48;
printf("%s",a[n]);
break; }
{n=num[2]-48;
n1=num[3]-48;
break;}
if(num[3]=='0');
{ n=num[2]-48;
printf("and %s",c[n]);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 37/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
printf( and %s ,c[n]);
break;}
if(num[2]=='1');
{n=num[3]-48;
break;} }}
return 0;}
Not everyone probably knows that Nivin has younder brother Nithin. Currently
Nithin learns to read.
#include
#include
int main()
scanf("%s",s); scanf("%d",&t);
while(t–)
{int i,l,j,cnt=0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 38/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%s",a); l=strlen(a);
for(i=0;i<l;i++) {
if(a[i]==s[j])
++cnt;}
if(cnt==3)
printf("Yes\n");
else
printf("No\n");
}
return 0;}
Elavenil likes strings a lot but she likes palindromic strings even more.
#include
#include
int main()
{int t;
scanf("%d",&t);
while(t–){
scanf("%s",pali);
n=strlen(pali);
for(i=0;i<n/2;i++){
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 39/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
if(pali[i]=='.'||pali[n-i-1]=='.'){
if(pali[i]==pali[n-i-1]){
pali[i]='a';
pali[n-i-1]='a'; }
pali[n-i-1]=pali[i];
else{
if(pali[i]!=pali[n-i-1]){
flag=1;
break;} }}
if(flag==0&&n%2==1){
if(pali[n/2]=='.')
pali[n/2]='a';}
if(flag)printf("-1\n");
Mohit has no work to do in the kitchen, so he decided to play a card game with the
following rules:
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 40/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
#include
int main()
{ char s[100002];
scanf("%d",&test);
while(test–)
{ scanf("%s",s);
flag=0;
int i;
for(i=0;i<strlen(s)-1;i++)
flag++; }
Jeferson was given a strings of length 8 consisting solely of 'O's and '1's
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 41/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
Jeferson was given a strings of length 8 consisting solely of O s and 1 s.
#include
#include
int main()
{ scanf("%s",arr); for(i=0;i<strlen(arr);i++) {
if(arr[i]!=arr[i+1])
if(count<=2)
printf("uniform\n");
else
printf("non-uniform\n");
#include
#include
#include
char a[MAX],b[MAX];
int t;
scanf("%d",&t); while(t–){
scanf("%s",a); scanf("%s",b);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 42/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
for(i=0;i<n;i++)
{if(isalpha(a[i])&&isalpha(b[i])&&a[i]!=b[i])
no++;}
if(no>0)
printf("No\n");
else printf("Yes\n"); }
return 0;}
#include
int main()
{int n;
scanf("%d", &n);
int r = leap(n);
return 0;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 43/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
int main(){
int a;
scanf("%d",&a);
else
return 0;
}
int i, sum=0;
for(i=1;i<=numbr/2; i++)
{
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 44/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{
if(numbr%i==0)
sum+=i;
}return sum;}
#include
int convert(int);
int main()
{int d;
return 0;
{ return ndays/365; }
#include
long facto(int n)
return 1;}
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 45/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{int q;
scanf("%d",&q);
printf("%ld", facto(q));
return 0;}
#include
while(n) {
sum+=n%10;
n/=10;}
return sum*k;}
int n=0;
} int main()
{int num;
return 0;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 46/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
if(n==1){
return; }
tHanoi(n-1,from_rod,aux_rod,to_rod);
tHanoi(n-1,aux_rod,to_rod,from_rod); }
int main()
Advika is trying to solve the puzzle problem during Mathematics class hour
#include
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 47/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int req,x,y;
{req=((x+1)/2)*((y+1)/2);
int main()
{ scanf("%d%d",&x,&y);
printf("%d",NccCells(x,y));
return 0;}
#include
int checkPali(int);
int main()
{int n;
scanf("%d",&n);
return 0;}
int rev=0,r,o=n;
while(n!=0){
r=n%10;
rev=rev*10+r;
n/=10;}
if(o==rev)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 48/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
return 1;
else
return 0;}
#include
int main()
int num,temp;
int a,b;
scanf("%d %d",&a,&b);
for(num=a;num<=b;num++)
temp=num;
if(check_armstrong(temp)==num)
printf("%d ",num);
return 0;
{
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 49/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int r,sum=0;
while(temp!=0)
r=temp % 10;
temp=temp/10;
sum=sum+(r*r*r);
} return sum; }
Selvan asks his friend Arav to buy the book. Arav would recommend a bookstall in
Thanjavur.
#include
#include
for(i=0;i<strlen(isbn)-1;i++)
term++;}
sum+=100;
if(sum%11==0)
return 1;
else
int main()
{char str[100];
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 50/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int t;
scanf("%d",&t);
while(t–)
if(strlen(str)>10)
printf("Invalid\n");
else
if(result)
printf("Valid\n");
else
printf("Invalid\n"); } }
return 0; }
A small country leader decided to bring some reforms after 25 years of his rule.
#include
union Citizen
{int age;
}; int main()
if((E.age > 18) && (E.age <= 100)) printf("Eligible"); else printf("Not Eligible");
return 0; }
#include
struct Time
{ int t; };
int main()
scanf("%d%d%d%d%d%d",&h1,&m1,&s1,&h2,&m2,&s2);
printf("%d:%d:%d",h1-h2,m1-m2,s1-s2);
return 0; }
Meera is a food blogger and all her fans craves for the photos of the new
restaurants and its dishes.
#include
struct video
char name[100];
int dish;
};
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 52/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int main()
int i=0,total=0;
for (i=0;i<7;i++)
scanf("%s %d",clip.name,&clip.dish);
total+=(clip.dish*3);
printf("%s : %d\n",clip.name,clip.dish*3);
printf("TOTAL : %d",total);
return 0;
Britta's brother owns a Grocery store and for their customers he usually gives the
manually written bill
#include
struct groceryshop{
int main()
int n,price;
float total_price,gst;
scanf("%s",tax.s);
scanf("%d %d",&n,&price);
total_price=n*price;
gst=total_price*0.14;
printf("%s\n%.2f\n%.2f\n%.2f",tax.s,total_price,gst,total_price+gst);
return 0;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 53/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
return 0;}
Hassan lives in a village and has to take the bus to college every day.
#include
union Time{
}t1,t2,t3,t4,t5,t6;
int main()
{scanf("%d %d",&t1.h1,&t2.h2);
scanf("%d %d",&t3.m1,&t4.m2);
scanf("%d %d",&t5.s1,&t6.s2);
printf("%d\n%d\n%d",(t1.h1-t2.h2),(t3.m1-t4.m2),(t5.s1-t6.s2));
return 0;
#include
#include
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 54/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
struct king
int main()
scanf("%s%s",path.s1,path.s2);
abs(x>y)?printf("%d\n",abs(x)):printf("%d\n",abs(y));
while(x||y)
if(x<0)
if(y>0)
{y–;printf("U");}
if(y<0)
{y++;printf("D");}
printf("\n"); }
#include
union number
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 55/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{ int n1;
int main()
{union number x;
scanf("%d",&x.n1);
printf("Age=%d years\n",x.n1);
scanf("%f",&x.n2);
printf("Height=%.2f cm",x.n2);
Nathan is new to an online export firm so he doesn't know about the currency
conversion involved during the export process.
#include
union price
{float inr;};
int main()
int i;
scanf("%d",&i);
while(i–){
scanf("%f",&book.inr);
printf("%.2f\n",book.inr*55.26);
return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 56/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
union Calculator
{ int a; };
int main()
return 0; }
Simon is a young aspiring cricketer who dreams of playing one day for the India
national cricket team.
#include
#include
struct circleshape
{int x1;
int x2;
int main()
int radius;
scanf("%d %d",&dis.x1,&dis.y1);
int r1 = pow(dis.x2-dis.x1,2);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 57/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
return 0; }
#include
#include
#define N 500000
}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 58/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int main(){
scanf("%d%d%d",&n,&k,&d);
for(i=0;i<n;i++)
scanf("%d",&aa[i]);
dd[0]=1,dd[1]=-1;
cnt=0;
for(i=0,j=0;i<=n;i++)
if((cnt+=dd[i])>0){
while(j<n&&aa[j]-aa[i]<=d)
j++;
if(i+k<=j){
dd[i+k]++;
dd[j+1]–;}}
#include
#include
return(*(int*)b-*(int*)a);
int main()
for(i=0;i<m;i++)
{
scanf("%d",&num);
a[num]++;
}
qsort(a,101,sizeof(int),cmpfunc);
{
num=0;
for(i=0;a[i]!=0;i++)
{
num+=(a[i]/day);
}
if(num>=n)
ans=day;
}
printf("%d",ans);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 60/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
printf( %d ,ans);
#include
int main()
{ int *ptr ,
scanf("%i %i"
, &first, &second);
ptr = &first;
qtr = &second;
printf("%i"
, sum);
addTwoNumbers(0,0);
return 0;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 61/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
{return 1;
} void sum();
int main()
{sum();
return 0;}
void sum(){
scanf("%d",&arr[i]);}
for(i=0;i<n;i++){
After long days Arun met with Nirmala in a Bank, and since then they are collecting
coins together.
#include
#include
int main(){
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 62/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
while(a[j])
return 0;
#include
int main()
{int x,y;
xptr=&x;
yptr=&y;
int *large;
printf("%d", *large);
return 0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 63/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
int calculateLength(char*);
int main() {
char str[20];
int length;
scanf("%s",str);
length = calculateLength(str);
printf("%d",length);
return 0;
while (*ch!='\0') {
count++;
ch++;
}
return count;
#include
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 64/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{int a,b,sum;
scanf("%d %d",&a,&b);
int *ptr=&a,*qtr=&b;
sum=*ptr + *qtr;
#include
int main()
{ int t;
while(t–)
ptr=numArray;
{
#include
return 0;
void input(){
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&arr1[i]);
for(i=0;i<n;i++)scanf("%d",&arr2[i]);
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(arr1[i]+arr1[j]>arr2[i]+arr2[j])total++;
}
}
printf("%d",total);
int main()
{input();
return 0;
}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 66/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
#include
#include
char str[1000005];
char temp[10];
struct trie
{ int i;
for(i=0;i<36;i++)
node->child[i]=NULL;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 67/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
node->value=-1;
node->set=false;
{ int i,len=strlen(str),flag,flag1;
for(i=0;i<len;i++)
head=head->child[str[i]-'0']; }
else
{ if(head->child[str[i]-'a'+10]==NULL)
flag=1;
while(head->value>=0&&flag)
head2=head;
snprintf(temp,2,"%d",head->value);
for(i=0;i<strlen(temp);i++)
head2->child[temp[i]-'0']=newnode();
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 68/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
head2 child[temp[i] 0 ] newnode();
flag=0; }
head2=head2->child[temp[i]-'0']; }
if(flag&&head2->set==true)
head->value++;
else{
head2->value++;
flag1=1;
if(flag==0){
printf("%d",head->value);
head2->set=true;
flag1=0; }
head->value++;
if(flag1)
head->set=true;
printf("\n");}
int main()
scanf("%d",&test);
while(test–)
{ scanf("%s",str);
printf("%s",str);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 69/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
printf( %s ,str);
lookup(root,str);
Click here!
#include
#include
int main()
{ int t;
scanf("%d",&t);
while (t–){
scanf("%d",&n);
scanf("%ld",&a[j]);
count++;
#include
#include
#define N 5000
int ia = *(int *) a;
int ib = *(int *) b;
return ia – ib;
int main() {
int n, k, h, i , j ;
scanf("%d", &aa[i]);
i++;
printf("%d\n", dp[n][k]);
return 0;
Vijay has given a set of points x1, x2, xn on the number line.
#include
#include
void i (){}
int main()
scanf("%d", a+i);
while(r < n)
if(a[r]-a[l] >= z)
sum++, l ++;
r++;
printf("%d", sum);
return 0;
#include
#include
int main() {
dp[1][0] = 0;
dp[1] = t;
#include
#include
int main() {
scanf("%d", &n);
while(n–) {
scanf("%d", &t);
if(t % 2)
o[ol++] = t ;
else
e[el++] = t ;}
ol–;
el–;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 75/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
t = 0;
if(ol) {
ol–;
while(ol)
t += o[–ol];
} else if(el) {
el–;
while(el)
#include
#include
int rand_(int n) {
return ia – ib;}
int main() {
scanf("%d", &n);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 76/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
max = 0;
i++;
The brave Knight came to the King and asked permission to marry the princess.
#include
#include
int t=0,i;
for( i=0;i<n;++i){
t=arr[2*i];
arr[2*i]=arr[2*i+1];
arr[2*i+1]=t;}}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 77/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
int t=0,i;
for( i=0;i<n;++i){
t=arr[i];
arr[i]=arr[i+n];
arr[i+n]=t; }
}int main()
{ int n,i,j;
scanf("%d", &n);
arr_2[i] = arr[i];}
int t1=-1,t2=-1;
for(i=0;i<2*n;++i){
if(arr[i]!=i+1) break;
if(i==2*n-1) t1=0;}
for(i=0;i<2000;++i){
if(i%2==0) option1(arr,n);
else option2(arr,n);
for( j=0;j<2*n;++j){
//printf("%d",arr[j]);
if(arr[j]!=j+1) break;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 78/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
if(arr[j]! j 1) break;
if(j==2*n-1) t1=i+1;}
if(t1!=-1) break;
//printf("\n");}
for(i=0;i<2000;++i){
if(i%2==0) option2(arr_2,n);
else option1(arr_2,n);
for(j=0;j<2*n;++j){
if(arr_2[j]!=j+1) break;
if(j==2*n-1) t2=i+1;}
if(t2!=-1) break;}
if(t1<t2) printf("%d\n",t1);
#include
#include
void hello(){}
int main()
scanf("%d",&n);
for(i=0;i<n;i++)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 79/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
{
scanf("%s",a);
scanf("%s",b);
scanf("%s",c);
scanf("%s",d);
scanf("%s",e);
scanf("%s",f);
scanf("%s",g);
scanf("%s",h);
printf("0\n");
break; }
else
printf("1\n");
break; }}
#include
int main()
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&ii[i]);
if(ii[1]==-1&&n==2)
printf("2");
printf("5");
printf("3");
The Gang of Friends went to one of their friend's sangeet function were they
planned to dance as a pair.
#include
#include
int main()
{ int test;
scanf("%d",&test);
while(test–)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 81/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%d",&arr1[i]);
scanf("%d",&arr2[i]);
qsort(arr1,n,sizeof(int),cmpfunc);
qsort(arr2,m,sizeof(int),cmpfunc);
i=0,j=0;
while(i
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 82/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
int main(void){
int testCount;
scanf("%d", &testCount);
while (testCount–){
int carArrives[50];
int becomeReady[5100];
int nextCar;
int totalPeople;
int i ;
if (cars == 0){
continue;}
doneCount = ridingCount = 0;
carArrives[i] = 0;
totalPeople = wander+ready;
becomeReady[i] = 0;
becomeReady[i] = (i-ready+1)*r;
nextCar = 0;
if (readyTime > k)
break;
readyTime = carArrives[nextCar];
carArrives[nextCar] = readyTime + p;
if (readyTime + p <= k)
doneCount++;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 84/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
doneCount ;
ridingCount++;}
carsWaiting = 0;
if (carArrives[i] <= k)
carsWaiting++;
return 0;}
A play school has a number of children and a number of treats to pass out to them.
#include
void loop()
int main()
int t;
scanf("%d",&t);
while(t–)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 85/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%d%d%d",&a,&b,&c);
d=(b%a)+c-1;
if(d<=a)
d=d;
else
d=d-a;
printf("%d\n",d);}
return 0;
#include
int main(){
int func[100050];
p[0] = 1LL;
p[1] = 1LL;
func[1] = 1LL;
int t ,i,n;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 86/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%d", &t);
while(t–){
scanf("%d", &n);
printf("%d\n", func[n]);
return 0;
Dharma and Tina has recently decided to learn about developing compilers.
#include
#include
#include
int main()
{ int c,f;
scanf("%ld",&t);
k=0;
c=getchar();
for(i=0;i<t;i++)
{c=getchar();
string[f++] = c;
c=getchar(); }
for(j=0;j<k;j++)
break; }
if(j==k)
strcpy(vars[k],string);
k++; }
#include
#include
#include
void Cube(){
int k,c;
scanf("%d %d",&k,&c);
if(c==0 || calc[k][k*k*k-c]==1)
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 88/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
printf("YES\n");
else
printf("NO\n");
int main(){
for(i=1;i<101;i++){
cubed=i*i*i;
for(j=0;j<cubed;j++){
val=(j*j*j)%cubed;
calc[i][val]=1;
scanf("%lld",&t);
while(t–){
Cube();
return 0;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 89/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
#include
#include
void l (){}
int main()
int q,x,y,z,*ans;
q=0;
ans=(int *)malloc(q*sizeof(int));
*ans=0;
int t ;
scanf("%d",&t);
while(t–)
scanf("%d %d %d",&x,&y,&z);
return 0;}
#include
#include
int main()
{int n;
int *ar=malloc(sizeof(int)*n);
*ar=n;
scanf("%d",&n);
int arr[100];
int i,j;
for(j=0;j<n;j++){
scanf("%d",&arr[j]);
qsort(arr,n,sizeof(int),cmpfunc);
int count=0;
for(i=0;i<n-1;){
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 91/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
( )
if(arr[i]==arr[i-1]){
count++;
i=i+2; }
else{
i++;}}
if(n==9||n==8||n==6)
printf("%d",count);
else
Sundar is well known for setting typical problems for the contest.
#include
#include
void harsh(){}
int main()
grp=(lint*)malloc(100001*sizeof(lint));
scanf("%d",&t);
while(t–)
{
for(i=0;i<2;i++)
scanf("%d",&grp[i]);
if(n==8||grp[1]==2)
else
}
return 0;
#include
#include
int main() {
scanf("%d",&t);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 93/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
while(t–)
prev=0;
np=1;
last=0;
scanf("%d",&n);
for(i=0;i<n;i++)
a[s]++;
if(last<s)last=s; }
for(i=last;i>0;i–)
if(prev==1)
a[i]–; }
if(a[i]&1)
prev=1;
a[i]–;
}
else
{ prev=0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 94/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{ prev 0;
eve:
while(a[i])
a[i]-=2;
printf("%lld\n",np);}
#include
typedef enum{Iceberg=15,Radicchio=20,Watercress=10,Arugula=21}Lettuce;
int main()
scanf("%u",&benefits);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 95/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
else
It is a winter super sale and all the shops have various offers.
#include
#include
void solve()
{ int t;
scanf("%d",&t);
while(t–)
scanf("%lld",&n);
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n;i++)
if(i+1<n)
sum+=arr[i+1];
int main()
{ solve();
#include
#define m 1000000007
int main()
{static int n,k,count; scanf("%d %d",&n,&k); int arr[n]; int i, j; for(i=0;i<n;i++) arr[i]=i+1;
for(i=2;i<=k;i++) {
count=0;
count=(count+arr[j])%m; arr[j]=count;}}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 97/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
Rohan wanted to distribute 'N' Dragon Fruits among people according to the
following condition
#include
#include
void solve();
int main()
{ solve();
void solve()
{ int t;
scanf("%d",&t);
while(t–)
for(i=2;i<=sqrt(N);i++)
if (flag == 1)
#include
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 98/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
()
{ int t;
scanf("%d",&t);
while(t–)
int i;
for(i=0;i<y-1;i++)
{
x=(a*x)%mod;
}
printf("%llu\n",x);
return 0;
Consider an analog clock whose hour and minute hands are A and B centimeters
long, respectively.
#include
#include
#define pi 3.14159265358979323846
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 99/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
return 0;
printf("%lf",h);}
Susi's Birthday is near so she had started planning a party for all of her friends.
#include
#include
int main()
{int t ,i,j,c,n,k,sm,d;//c0[100][100]={0},a;
scanf("%d",&t);
while(t–)
{sm=0;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 100/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
scanf("%d %d",&n,&k);
if(1>2)
for(j=1;j<pow(2,k);j++)
printf("fooled yahhh");
char s[n][k];
for(i=0;i<n;i++)
scanf("%s",s[i]);
for(j=0;j<k;j++)
{c=0;
for(i=0;i<n;i++)
{if(s[i][j]=='1')
c++;
// else c0[i][j]++;}
d=c;
if(d>sm)
{sm=d;
// a=j;}}
if(n-sm+1==5)
{printf("3\n2");break;}
#include
int main()
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 101/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
()
scanf("%lld",&t);
while(t–)
scanf("%lld",&n);
total = ((n*(n-1))/2)-n;
if(total>0)
printf("%lld\n", total);
else
printf("0\n");}
Imagine the field is a 2D plane. Each cell is either water 'W' or a tree 'T'.
#include
int main()
scanf("%d",&n);
for(i=0;i<n;i++)
i++;
for(j=0;j<n;j++)
j++;
biggest(i,j,n);
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 102/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
gg ( j )
if(n==7)
printf("14");
printf("5");
printf("12");
else
printf("4");
Given a chess board having AXA cells, you need to place A queens on the board in
such a way that no queen attacks any other queen,
#include
#include
int a;
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 103/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
{int i , j ;
if (board[row][i])
return false;
if (board[i][j])
return false;
if (board[i][j])
return false;
return true;}
{ int i ;
if (col >= a)
return true;
{ board[i][col] = 1;
return true;
board[i][col] = 0;
}} return false;}
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 104/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
}} return false;}
bool solveNQ()
{ int board[a][a],i,j;
for(i=0;i<a;i++)
for(j=0;j<a;j++)
board[i][j]=0;
if (solveNQUtil(board, 0) == false)
{ printf("Not possible");
return false;}
else
printf("%d ",board[j][i]);
int main()
{ scanf("%d",&a);
solveNQ();
return 0;}
Tags: srm ap srm chennai srm coding srm coding society srm elab srm oops
Leave a Reply
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 105/106
9/30/21, 2:15 PM First Year ELAB Level 1 (i) (2021) - SRMnotesADDA
https://srmnotesadda.in/first-year-elab-level-1-i-2021/ 106/106