My issue
I need a small hint please
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: Bucket Game Practice Coding Problem - CodeChef
I need a small hint please
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: Bucket Game Practice Coding Problem - CodeChef
@ramzialoulou
Think of even odd count of numbers and also think of the case when u get Draw as the answer.
For better understanding plzz refer my code.
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
int cnt=0,cnt1=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]%2!=0)
{
if(a[i]==1)
cnt1++;
else
cnt++;
}
}
if(cnt1%2==0)
{
if(cnt%2!=0)
{
cout<<"Alice";
}
else if(n==cnt1)
cout<<"Draw";
else
cout<<"Bob";
}
else
{
if(cnt==1&&cnt+cnt1==n)
cout<<"Draw";
else if(cnt%2!=0)
cout<<"Bob";
else
cout<<"Alice";
}
cout<<endl;
}
}