Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- constexpr int NMAX = 53;
- int cube[NMAX][NMAX][NMAX], n;
- void readCube() {
- cin >> n;
- for (int z = 1; z <= n; z++) {
- for (int x = 1; x <= n; x++) {
- for (int y = 1; y <= n; y++) {
- cin >> cube[z][x][y];
- }
- }
- }
- }
- signed main() {
- readCube();
- int x1, x2, y1, y2, z1, z2;
- cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
- int sum = 0;
- for (int z = z1; z <= z2; z++) {
- for (int x = x1; x <= x2; x++) {
- for (int y = y1; y <= y2; y++) {
- sum += cube[z][x][y];
- }
- }
- }
- cout << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement