diff options
Diffstat (limited to 'graphs/task1.cpp')
| -rw-r--r-- | graphs/task1.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/graphs/task1.cpp b/graphs/task1.cpp index 1fea795..af9aba3 100644 --- a/graphs/task1.cpp +++ b/graphs/task1.cpp @@ -1,5 +1,6 @@ #include<iostream> #include<vector> +#include<algorithm> using namespace std; @@ -57,8 +58,16 @@ int main() cin >> q; q--; + int deg_m = int(g[q].size()); + int deg_p = 0; + for (int i = 0; i < int(g.size()); ++i) + { + if (find(g[i].begin(), g[i].end(), q) != g[i].end()) + ++deg_p; + } + cout << "С данной вершиной смежны " - << g[q].size() + << deg_m + deg_p << " вершин" << endl; return 0; |