F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Even Tree Split

Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 653    Accepted Submission(s): 281


Problem Description
You are given an undirected tree with $n$ nodes. It's guaranteed that $n$ is even.

You are going to delete some of the edges (at least $1$), and have to let each of the remaining connected components have an even number of vertices.

Calculate the number of ways to delete the edges that satisfy such constraints, modulo $998244353$.
 

Input
The first line contains an integer $T(1 \leq T \leq 30)$ - the number of test cases.

The first line of each test case contains an integer $n(1 \leq n \leq 10^5)$ - the number of vertices on the tree.

The next $n-1$ lines of each test case contain two integers $u,v(1 \leq u,v \leq n)$, representing an edge between $u$ and $v$.

It is guaranteed that the input graph is a tree with even number of vertices.
 

Output
For each test case, output the number of ways to delete the edges that satisfy such constraints in a single line, modulo $998244353$.
 

Sample Input
2 2 1 2 4 1 2 2 3 3 4
 

Sample Output
0 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-24 12:16:23, Gzip enabled