結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-13 12:31:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 407 bytes |
| コンパイル時間 | 3,033 ms |
| コンパイル使用メモリ | 195,804 KB |
| 最終ジャッジ日時 | 2025-01-09 06:37:34 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
#define endl enjoy_codeforces
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
lint n;std::cin>>n;
std::vector<lint>deg(n);
for(lint i=0;i<n-1;i++){
lint u,v;std::cin>>u>>v;u--,v--;
deg.at(u)++;
deg.at(v)++;
}
int ans=0;
for(int x:deg)ans+=std::max(0,x-2);
std::cout<<ans<<'\n';
}
ngtkana