csansoon

P3.07 P19991 Chess board (3)

Oct 2nd, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main () {
  5.         int x1,x=1,t=0;
  6.         string n;
  7.         cin >> x1;
  8.         while (x<=x1) {
  9.             cin >> n;
  10.             t = t + (n[x-1] - 48) + (n[x1-x] - 48);
  11.             if ((x-1) == (x1-x)) t=t-(n[x-1]-48);
  12.             x++;
  13.         }
  14.         cout << t << endl;
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment