Advertisement
Guest User

name

a guest
Dec 5th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n , q ;
  6. cin >> n >> q;
  7. int a[100];
  8. for (int i = 0 ; i < n ; i++)
  9. cin >> a[i];
  10.  
  11. int t , x , l , r;
  12. for (int k = 0 ; k < q ; k++){
  13. cin >> t;
  14. if (t == 1){
  15. cin >> x;
  16. if (a[x-1] == 0)
  17. a[x-1] = 1;
  18. else
  19. a[x-1] = 0;
  20. }
  21. else{
  22. cin >> l >> r;
  23. if (a[r-1] == 1)
  24. cout << "ODD";
  25. else
  26. cout << "EVEN";
  27. cout << endl;
  28. }
  29. }
  30.  
  31. /*
  32. // From binary to decimal
  33. int b[100];
  34. int nn ;
  35. cin >> nn;
  36. for (int i = 0 ; i < n ; i++)
  37. cin >> b[i];
  38.  
  39. int two = 1 , sum = 0;
  40. for (int i = n - 1 ; i >= 0 ; i--){
  41. sum += b[i] * two;
  42. two *= 2;
  43. }
  44. cout << sum ;
  45.  
  46. */
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement