Saleh127

CF 1375A

Jul 4th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9.  
  10. test
  11. {
  12. ll a[100000],c,d=0,e=0,f,i,j,k,l;
  13. cin>>c;
  14. for(i=0;i<c;i++)
  15. {
  16. cin>>a[i];
  17. }
  18. for(i=0;i<c;i++)
  19. {
  20. if(i%2==0)
  21. {
  22. if(a[i]>0) a[i]=-a[i];
  23. }
  24. else
  25. {
  26. if(a[i]<0) a[i]=-a[i];
  27. }
  28. }
  29. for(i=0;i<c;i++)
  30. {
  31. cout<<a[i]<<" ";
  32. }
  33. cout<<endl;
  34. }
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment