Sir
I was able to solve this problem as i tested random inputs and it was giving correct output but the code wasn’t getting submitted and was saying wrong answer.
So, I unlocked the editorial and testcases, and they matched my answer correctly. Also the test cases were giving correct output. But still. it is not getting submitted.
I’m pasting my code here and attaching the editorial solution photo.
Kindly help.
Tushar
#include
using namespace std;
int main() {
int N;
cin>>N;
int n;
int z;
int even=0, odd=0;
for(int i=0; i<N; i++)
{
cin>>n;
while(n>0)
{
z=n%10;
if(z%2==0)
{
even+=z;
}
else
{
odd+=z;
}
n=n/10;
}
if(even%4==0 || odd%3==0)
{
cout<<"YES"<<endl;
even=0;
odd=0;
}
else
{
cout<<"NO"<<endl;
even=0;
odd=0;
}
}
return 0;
}