Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream f("date.in");
- int a[100][100]={0}, sum[100]={0};
- int n, m;
- f>>n;
- f>>m;
- for(int i=0; i<m; i++)
- {
- int x, y;
- f>>x>>y;
- a[x][y]=1;
- a[y][x]=1;
- }
- f.close();
- for(int i=1; i<=n; i++)
- {
- int s=0;
- for(int j=1; j<=n; j++)
- {
- //s+=a[j][i];
- s+=a[i][j];
- }
- a[0][i]=s;
- if(s == 0)
- cout<<"nodul "<<i<<" este izolat"<<endl;
- if(s == 1)
- cout<<"nodul "<<i<<" este terminal"<<endl;
- }
- int max=a[0][1];
- for(int i=1; i<=n; i++)
- if(a[0][i] > max)
- max=a[0][i];
- for(int i=1; i<=n; i++)
- if(a[0][i] == max)
- cout<<"nodul "<<i<<" are grad maxim = "<<a[0][i]<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement