crsandu

Untitled

Jan 3rd, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. Problema: http://www.pbinfo.ro/?pagina=probleme&id=488
  2.  
  3. #include <iostream>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int n, v, k[10000];
  9.  
  10. int main()
  11. {
  12.     cin >> n;
  13.     for (int i=1; i<=n; i++)
  14.     {
  15.         cin >> k[i];
  16.     }
  17.     for (int i=1; i<=n; i++)
  18.     {
  19.         if (i % 2 == 0)
  20.         {
  21.             cout << k[i] << " " ;
  22.         }
  23.     }
  24.     cout << endl;
  25.     for (int i=n; i>0; i--)
  26.     {
  27.         if (i % 2 == 1)
  28.         {
  29.             cout << k[i] << " " ;
  30.         }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment