repl.it
@cream_puff_four/

Testing Thing

C++11

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int arr[n][n];
	memset(arr, 0, sizeof(arr));
	int x, y, value = 1;
  while (x != 0 && y != 0 && value != 0) {
    cin >> x >> y >> value;
    arr[x][y] = value;
  }
	for (int i = n - 2; i >= 0; i --) {
		for (int j = n - 2; j >= 0; j --) {
			arr[i][j] = arr[i + 1][j] + arr[i][j + 1];
		}
	}
	cout << arr[0][0];
}