結果

問題 No.806 木を道に
ユーザー 👑 CleyL
提出日時 2022-05-02 18:34:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 73,796 KB
最終ジャッジ日時 2025-01-29 01:56:40
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n;cin>>n;
  vector<int> B[n];
  for(int i = 0; n-1 > i; i++){
    int s,v;cin>>s>>v;
    B[--s].push_back(--v);
    B[v].push_back(s);
  }
  int ans = 0;
  for(int i = 0; n > i; i++){
    ans += max(0,(int)B[i].size()-2);
  }
  cout << ans << endl;
}
0