Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int impar(int x[], int s, int d)
  6. { 
  7. if(s==d)
  8.        if(x[s]%2!=0)
  9.              return 1;
  10.        else
  11.              return 0;
  12.    else
  13.   {  int m=(s+d)/2;
  14.       return impar(x,s,m)+impar(x,m+1,d);
  15. }
  16. }
  17. int main()
  18. { int x[100],n,i;
  19.   cin>>n;
  20.   for(i=0;i<n;i++)
  21.    cin>>x[i];
  22.   if(impar(x,0,n-1)>=1)
  23.      cout<<"da";
  24. else
  25.    cout<<"nu";
  26. return 0;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement