結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2019-11-10 17:38:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 453 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 46,720 KB |
| 最終ジャッジ日時 | 2025-01-08 03:49:18 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <cstdio>
#include <vector>
int input() {
int ret = 0; char c = getchar_unlocked();
while ('0' <= c && c <= '9') { ret = ret * 10 + (c - '0'); c = getchar_unlocked(); }
return ret;
}
int main() {
int n = input();
std::vector<int> cnt(n);
for (int i = 0; i < n - 1; ++i){
++cnt[input() - 1];
++cnt[input() - 1];
}
int ans = 0;
for (int a : cnt)
if (a > 2)ans += a - 2;
printf("%d", ans);
}
yuruhiya