Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- int main() {
- ios_base::sync_with_stdio(false) , cin.tie(nullptr) , cout.tie(nullptr) ;
- int n , summd = 0 , sumsd = 0;
- cin >> n ;
- int arr[n][n] ;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n && cin >> arr[i][j] ; j++) {
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- if (i == j)
- summd += arr[i][j] ;
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = n - 1; j > 0; j--) {
- sumsd += arr[0][n - 1] ;
- n-- ;
- i++ ;
- }
- }
- cout << abs(summd - sumsd) ;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment