Solutions

I hope you all had a lovely time since I posted my last post.

More than sufficient time has been provided to you all to work hard, brainstorm and write your own outstanding codes of the questions given to you all in my previous post.

For those who want to give a glance to the questions, here is the link of the practice question post.

Solutions of those questions are below::

Solution for DOUBLE ::

for i in range(eval(input())):
l=int(input())
if(l%2==0):
print(l)
else:
print(l-1)

// Oops c++ fellas this code is in python😛

Solution for ADASCHOOL ::

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t,m,n;
cin>>t;
while(t–)
{ // Again C++🤷🏻‍♀️
cin>>n>>m;
ll pro=0;
pro=n*m;
if(pro%2==0)
cout<<“YES”<<endl;
else
cout<<“NO”<<endl;
}
return 0;
}

Solution for CV ::

using namespace std;
int main()
{
int t,n,s,count;
char str[100];
cin>>t;
while(t–){
cin>>n;
cin>>str;
count=0;
for(int i=0;i<n;i++)
{
if(str[i]==’a’ || str[i]==’e’|| str[i]==’i’||str[i]==’o’||str[i]==’u’)
continue;
else
if(str[i]!=’a’ || str[i]!=’e’|| str[i]!=’i’||str[i]!=’o’||str[i]!=’u’)
{
if(str[i+1]==’a’|| str[i+1]==’o’|| str[i+1]==’e’||str[i+1]==’i’||str[i+1]==’u’)
count++;
}
}
cout<<count<<endl;
}
}

Solution for THREE FRIENDS ::

#include<bits/stdc++.h>
using namespace std;
int main()
{
long int t,x,y,z;
cin>>t;
while(t–)
{
cin>>x>>y>>z;
if(x==abs(y+z) || y==abs(x+z) || z==abs(x+y) )
cout<<“yes”<<endl;
else
cout<<“no”<<endl;

}
return 0;

}

Solution for IPL And RBC ::

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t,x,y;
cin>>t;
while(t–)
{
cin>>x>>y;
ll a=0;
a=x-y;
if(a<0)
a=0;
cout<<a<<endl;
}
return 0;
}

Kinda busy with my own stuffs nowadays 😅. Hope to connect with you all soon.

Till then, Keep Coding

One thought on “Solutions

Leave a reply to dignity22 Cancel reply