# Editorial for apple_cut, https://www.codechef.com/BEST2021/problems/APPCUT12

Practice

Author: Anurag dubey
Tester: anrag dubey
Editorialist: anurag dubey

CAKEWALK.

Math.

# PROBLEM:

One hot summer day abhi and his friend sachu decided to buy a apple. They choose the biggest and the ripest one, in their opinion. After that the apple was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.

sachu and abhi are great fans of even numbers, that’s why they want to divide the apple in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that’s why you should help them and find out, if they can divide the apple in the way they want. For sure, each of them should get a part of positive weight.

# QUICK EXPLANATION:

There is given a apple weight we have to divide the apple in such a manner that they both get a even number of kilos. and this is possible only when the given weight should be even number .

# EXPLANATION:

Since we have have to divide the apple such that they both get apple in even weight
if we take a weight 8, and if we divide it like 4 and 4 then they both get even number of weight or then we have to print yes . if not possible then print no .

# SOLUTIONS:

Setter's Solution

//apple_cut
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
unsigned int n;
cin>>n;
if(n<=2)
{
cout<<“NO”;
}
else if(n%2==0)
cout<<“YES”;

``````else
cout<<"NO";
``````

}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}

Tester's Solution

//apple_cut
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
unsigned int n;
cin>>n;
if(n<=2)
{
cout<<“NO”;
}
else if(n%2==0)
cout<<“YES”;

``````else
cout<<"NO";
``````

}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}

Editorialist's Solution

//apple_cut
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
unsigned int n;
cin>>n;
if(n<=2)
{
cout<<“NO”;
}
else if(n%2==0)
cout<<“YES”;

``````else
cout<<"NO";
``````

}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}