Skip to content

Instantly share code, notes, and snippets.

@joaogui1
Created June 19, 2017 15:03
Show Gist options
  • Save joaogui1/fdcec9a904f1a2c536d98049e5b2b366 to your computer and use it in GitHub Desktop.
Save joaogui1/fdcec9a904f1a2c536d98049e5b2b366 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
int mat[128][128];
int main(){
int n;
cin >> n;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
cin >> mat[i][j];
for(int i = 2; i <= n; ++i)
for(int j = 2; j <= n; ++j){
if(mat[i - 1][j] + mat[i][j - 1] + mat[i - 1][j - 1] > 1) mat[i][j] = 0;
else mat[i][j] = 1;
}
cout << mat[n][n] << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment