結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
silopy
|
| 提出日時 | 2019-07-06 01:15:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 317 bytes |
| コンパイル時間 | 491 ms |
| コンパイル使用メモリ | 65,944 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 14:03:27 |
| 合計ジャッジ時間 | 2,193 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
using lint=int64_t;
int main()
{
int N;
int cnt[100010]={};
cin >> N;
for(int i=0;i<N-1;i++)
{
int a,b;
cin >> a >> b;
cnt[a-1]++;
cnt[b-1]++;
}
int ans=0;
for(int i=0;i<N;i++)
ans+=max(0,cnt[i]-2);
cout << ans << endl;
return 0;
}
silopy