結果
問題 | No.806 木を道に |
ユーザー |
![]() |
提出日時 | 2019-07-01 15:34:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 121 ms / 2,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 664 ms |
コンパイル使用メモリ | 66,272 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-07-16 03:00:37 |
合計ジャッジ時間 | 2,778 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
#include<iostream> #include<map> using namespace std; int main(){ int N; cin >> N; map<int,int> m; for(int i=1;i<N;i++){ int a,b; cin >> a >> b; m[a]++;m[b]++; } long long ans=0; for(auto it=m.begin();it!=m.end();it++){ if(it->second-2>=0){ ans+=it->second-2; } } cout << ans << endl; }