結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-22 21:52:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 319 bytes |
| コンパイル時間 | 1,267 ms |
| コンパイル使用メモリ | 159,852 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 05:15:57 |
| 合計ジャッジ時間 | 2,958 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
int deg[100000];
int main(){
int N;
std::cin>>N;
for(int i=0;i<N-1;++i){
int a;
int b;
std::cin>>a>>b;
--a;
--b;
++deg[a];
++deg[b];
}
int ans=0;
for(int i=0;i<N;++i){
if(deg[i]==1)++ans;
}
ans-=2;
std::cout<<ans<<std::endl;
return 0;
}