結果
| 問題 | No.806 木を道に |
| コンテスト | |
| ユーザー |
leaf_1415
|
| 提出日時 | 2019-03-22 21:34:08 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| + 209µs | |
| コード長 | 355 bytes |
| 記録 | |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 77,056 KB |
| 実行使用メモリ | 8,972 KB |
| 最終ジャッジ日時 | 2026-08-30 17:50:58 |
| 合計ジャッジ時間 | 2,238 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int n;
vector<int> G[100005];
int main(void)
{
cin >> n;
int u, v;
for(int i = 0; i < n-1; i++){
cin >> u >> v;
G[u].push_back(v);
G[v].push_back(u);
}
int ans = 0;
for(int i = 1; i <= n; i++){
if(G[i].size() > 2) ans += G[i].size() - 2;
}
cout << ans << endl;
return 0;
}
leaf_1415