tuttelikz

#15 - Дороги [+]

Sep 25th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <math.h>
  4. using namespace std;
  5. int main() {
  6.     // insert code here...
  7.     freopen("INPUT.txt", "r", stdin);
  8.     freopen("OUTPUT.txt", "w", stdout);
  9.     int n;
  10.     int a[1000][1000];
  11.     int count;
  12.     cin>>n;
  13.     for (int i=0; i<n; i++) {
  14.         for (int j=0; j<n; j++) {
  15.             cin>>a[i][j];
  16.             if (a[i][j] == 1) {
  17.                 count++;
  18.             }
  19.         }
  20.     }
  21.     cout<<count/2<<endl;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment