Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main()
- {
- ll n;
- cin >> n;
- vector<vector<ll>> z1(n, vector<ll>(n, 0));
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- cin >> z1.at(i).at(j);
- }
- }
- ll pr, sN = 0, sS = 0, sE = 0, sW = 0;
- if (n % 2 == 0)
- {
- pr = n / 2 - 1;
- }
- else
- {
- pr = n / 2;
- }
- for (int i = 0, h = 1; i < pr; i++, h++)
- {
- int w;
- sN += accumulate(z1.at(i).begin() + h, z1.at(i).begin() + n - h, w);
- }
- cout << sN << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment