#include <iostream>
using namespace std;
int main()
{
int num;
cin >> num >> num;
int* ans = new int[num];
for (int jjj = 0; jjj < num; jjj++) cin>> ans[jjj];
for (int jjj = 1; jjj < num; jjj++) {
if (ans[jjj - 1] != ans[jjj] - 1) cout << ans[jjj - 1] << ",";
else {
cout << ans[jjj - 1];
int kkk = jjj;
for (kkk; kkk < num; kkk++)
if (ans[kkk - 1] != ans[kkk] - 1) break;
if (kkk - jjj > 1) cout << "-" << ans[kkk - 1];
else cout << "," << ans[kkk - 1];
jjj = kkk;
if (num - jjj) cout << ",";
}
if (num - jjj == 1) cout << ans[jjj];
}
}
Поделитесь своими знаниями, ответьте на вопрос:
х Кбайт - 120 с
х = 24 * 120/80 = 36 Кбайт
х=36