- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
#include <iostream>
#include <vector>
#include <string>
int main()
{
int n = 6;
std::vector<int> vec;
for (int i = 0; i < n; i++)
{
if ((i % 2) == 0)
{
std::reverse(vec.begin(), vec.end());
}
vec.push_back(i);
if ((i % 2) != 0)
{
std::reverse(vec.begin(), vec.end());
}
for (int j = 0; j < vec.size(); j++)
{
std::cout << vec[j] + 1;
if (j != vec.size() - 1)
{
std::cout << "-";
}
}
std::cout << "\n";
}
}