aboutsummaryrefslogtreecommitdiff
path: root/semestr-3/pf/lista2/cze.cpp
blob: da58fa5e871553eff3c0f4a57c4baa3fabe930bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;

int tab[1000010];

int main()
{
  int wsk = 0;

  while (true)
  {
    cin >> tab[wsk];
    if (tab[wsk] == -1)
      break;
    wsk++;
  }

  for (int i = 0; i < wsk; i += 2) // i += 2 <=> i = i + 2
  {
    cout << tab[i] << " ";
  }
  cout << "-1\n";

  for (int i = 1; i < wsk; i += 2)
  {
    cout << tab[i] << " ";
  }
  cout << "-1\n";
}