eolymp
bolt
Try our new interface for solving problems
Problems

Count the number of edges

Count the number of edges

The directed graph is given with an adjacency matrix. Find the number of edges in a graph. \InputFile The first line contains the number of vertices in the graph $n\:(1 \le n \le 100)$. Then given $n$ lines with $n$ numbers $0$ or $1$ --- the adjacency matrix of the graph. \OutputFile Print the number of edges in a graph. \includegraphics{https://static.e-olymp.com/content/f6/f6252c9ff7784dea1613accaf4a7f16ea7bbd4cb.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
0 1 1
1 0 1
0 1 1
Output example #1
6