結果
| 問題 | No.806 木を道に |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2019-03-22 22:09:08 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 76,556 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-07 12:18:47 |
| 合計ジャッジ時間 | 1,840 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int n;
int cnt[100000];
int main() {
int i;
cin >> n;
for (i = 0; i < n - 1; i++) {
int a, b;
cin >> a >> b; a--; b--;
cnt[a]++;
cnt[b]++;
}
int ans = 0;
for (i = 0; i < n; i++) {
if (cnt[i] >= 3) {
ans += cnt[i] - 2;
}
}
cout << ans << endl;
return 0;
}
startcpp