Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[100][100] = {0};
- int n, m;
- cin >> n >> m;
- for(int i = 0; i < m; i++)
- {
- int x, y;
- cin >> x >> y;
- a[x][y] = 1;
- a[y][x] = 1;
- }
- for(int i = 1; i <= n; i++)
- {
- int s = 0;
- for(int j = 1; j <= n; j++)
- {
- s += a[i][j];
- s += a[j][i];
- }
- if(s == 0)
- cout << "Nodul " << i << " este nod izolat\n";
- if(s == 1)
- cout << "Nodul " << i << " este nod terminal\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement