結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
i_mrhj
|
| 提出日時 | 2019-08-07 12:52:41 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 725 bytes |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 31,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 18:18:04 |
| 合計ジャッジ時間 | 1,612 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
int
main(int argc, char **argv)
{
int n, a, b, cnt[100000] = {};
scanf("%d", &n);
for (int i = 0; i < n - 1; i++) {
scanf("%d %d", &a, &b);
a--; b--;
cnt[a]++; cnt[b]++;
}
int ans = 0;
for (int i = 0; i < n; i++) {
if(cnt[i] == 1) ans++;
}
ans -= 2;
printf("%d\n", ans);
return 0;
}
i_mrhj