Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(0), cin.tie(0);
- // freopen("flipping.in", "r", stdin);
- int n;
- cin >> n;
- int face[n][n];
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- cin >> face[i][j];
- }
- }
- int count = 1;
- for(int i=n-1; i>=0; i--){
- for(int j=n-1; j>=0; j--){
- if(face[i][j] == 1){
- count++;
- for(int row = 0; row<n; row++){
- for(int col = 0; col<n; col++){
- face[row][col] = 1-face[row][col];
- }
- }
- }
- }
- }
- cout << count << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement