Advertisement
Saleh127

Untitled

Apr 17th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a[100000],b,c=1,d,e,f,i,j,k,l;
  6. cin>>b;
  7. for(i=0; i<b; i++)
  8. {
  9. cin>>a[i];
  10. }
  11. for(j=0; j<b; j++)
  12. {
  13. if(a[j]%2)
  14. {
  15. printf("%d\n",(c+a[j])/2);
  16. c*=-1;
  17. //for the difference of odd and even number;
  18. }
  19. else printf("%d\n",a[j]/2);
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement