#include <iostream>
#include <vector>
#include <cstdint>
using namespace std; template <class T>
istream& operator>>(istream &in, vector<T> &vec) { for (auto &it : vec) in >> it; return in;
}
template <class T>
ostream& operator<<(ostream &out, vector<T> &vec) { for (auto &it : vec) out << it << ' '; return out;
}
template <class T, class U>
istream& operator>>(istream &in, pair<T, U> &pair) { in >> pair.first >> pair.second; return in;
}
template <class T, class U>
ostream& operator<<(ostream &out, pair<T, U> &pair) { out << pair.first << ' ' << pair.second; return out;
}
signed main(void) { int32_t n; cin >> n; vector<vector<int64_t>> a(n, vector<int64_t>(n,-1)); int64_t x = 0, y = n/2; a[x][y] = 1; for(int32_t i = 2; i <= n*n; ++i) { int _x = x, _y = y; if(!x) { x = n-1; } else { --x; } if(y == n-1) { y = 0; } else { ++y; } if(a[x][y] != -1) { x= _x, y = _y; while(a[x][y] != -1) { if(x == n-1) { x = 0; } else { ++x; } } } a[x][y] = i; } for(int32_t i = 0; i < n; ++i) { cout << a[i] << '\n'; } return 0; }
Объяснение:
Запишем на C++ то, что написано в условии.
Если надо, то код также прикрепил в виде файла
Списывать не хорошо)
Если повезёт увидемся в (СИРИУС)
ответ:
объяснение:
используем формулу нахождения объема:
i = m x n * i
подсчитаем каждый сомножитель в формуле, стараясь числа к степеням двойки:
m x n:
160 * 160 = 20 * 2³ * 20 * 2³ = 400 * 26 =
= 25 * 24 * 26
нахождение глубины кодирования i:
256 = 28
т.е. 8 бит на пиксель (из формулы кол-во цветов = 2i)
находим объем:
i = 25 * 24 * 26 * 23 = 25 * 213 - всего бит на всё изображение
переводим в кбайты:
(25 * 213) / 213 = 25 кбайт