mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
B - Star or Not
https://atcoder.jp/contests/abc225/submissions/26898727
This commit is contained in:
parent
2250e77034
commit
7896bca156
23
AtCoder/ABC225/B/B.cpp
Normal file
23
AtCoder/ABC225/B/B.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n, a, b;
|
||||
vector<int> g[100005];
|
||||
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i < n; i++) {
|
||||
cin >> a >> b;
|
||||
g[a].push_back(b);
|
||||
g[b].push_back(a);
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (g[i].size() == n - 1) {
|
||||
cout << "Yes" << endl;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
cout << "No" << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user