From 7896bca1564f7f19c6f41670e6872996aa0a90e5 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sat, 30 Oct 2021 20:12:18 +0800 Subject: [PATCH] B - Star or Not https://atcoder.jp/contests/abc225/submissions/26898727 --- AtCoder/ABC225/B/B.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 AtCoder/ABC225/B/B.cpp diff --git a/AtCoder/ABC225/B/B.cpp b/AtCoder/ABC225/B/B.cpp new file mode 100644 index 00000000..843da86d --- /dev/null +++ b/AtCoder/ABC225/B/B.cpp @@ -0,0 +1,23 @@ +#include + +using namespace std; + +int n, a, b; +vector 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; +}