Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define vi vector<int>
  6. #define ll long long
  7. #define pb push_back
  8. #define mp make_pair
  9. #define ii pair<int,int>
  10.  
  11.  
  12. int main(){
  13. double n,a;
  14. vector<double> b;
  15.  
  16. cin >> n;
  17. for (int i = 0; i < n; i++)
  18. {
  19. cin >> a;
  20. if(a < 0){
  21. a = a*(-1);
  22. if ((i % 2)==0)
  23. {
  24. a = floor(a/2);
  25. b.pb(a*(-1));
  26. }else{
  27. a = ceil(a/2);
  28. b.pb(a*(-1));
  29. }
  30.  
  31. }else{
  32. if ((i % 2)==0)
  33. {
  34. b.pb(floor(a/2));
  35. }else{
  36. b.pb(ceil(a/2));
  37. }
  38. }
  39. }
  40.  
  41. for (int i = 0; i < b.size(); ++i)
  42. {
  43. cout << b[i] << endl;
  44. }
  45. return 0;
  46. }
  47.  
  48.  
  49. /*
  50. compilar
  51. g++ arquivo.cpp -std=c++11 -o executavel
  52. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement