DCP-275: Unmarried Persons Back to All Problems

Easy Beginners Problems > Ad-hoc


Royel is the oldest man in the village named boyaliya. He is now at 500 years old. In the meantime his family become the largest family in the world. So, it is tough to him to know the number of unmarried persons in his family. **If one has no childs is considered as unmarrid person.** Your task to find the number of unmarried persons. Input -- First line for test cases **T**. Each test case there is given the tree of Royel family. In first line **n** for the number of family members and next **n-1** line contains the relation **a, b** means **a** is parent of **b**. Constraints: -- T<=100 1<n<=10000 1<=a,b<=n Output -- Each line print the numbers of unmarried child. Sample input -- 2 3 1 2 2 3 4 2 3 2 4 1 2 Sample output -- 1 2


Problem Setter:

Monikrishna Roy

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

143/256

Solve/Submission

Ranking

# User Language Timing
01 feodorv Cpp14 0.03s
02 Morass Cpp14 0.04s
03 I_See_You Cpp14 0.05s
04 habib_rahman Cpp14 0.05s
05 swapnilsaha Cpp14 0.06s
06 MRITuhin Cpp14 0.06s
07 Jubair_123 Cpp14 0.07s
08 _GhOstMan_ Cpp14 0.07s
09 anamibnaharun Cpp14 0.07s
10 dmehrab06 Cpp14 0.07s
11 rafiul41 Cpp14 0.07s
12 khatribiru Cpp14 0.07s
13 rafsan_rana Cpp14 0.07s
14 DarkknightRHZ Cpp14 0.07s
15 Foyaz05 Cpp14 0.07s
16 hrOarr Cpp14 0.07s
17 Sarwar05 Cpp14 0.07s
18 _dipu Cpp14 0.07s
19 ovis96 Cpp14 0.07s
20 bafar Cpp14 0.07s
21 MAD_coder Cpp14 0.07s
22 Anubis Cpp14 0.07s
23 nurshuvo51 Cpp14 0.07s
24 sahedsohel Cpp14 0.07s
25 SakibAlamin Cpp14 0.07s
26 seyedssz Cpp14 0.07s
27 Dinar Cpp14 0.08s
28 MRoy Cpp14 0.08s
29 Aizen Cpp14 0.08s
30 rayhan50001 Cpp14 0.08s
31 Shadab Cpp14 0.08s
32 saiful130104 Cpp14 0.08s
33 onucsecu Cpp14 0.08s
34 Unseen Cpp14 0.08s
35 ksohan Cpp14 0.08s
36 saurabh3240 Cpp14 0.08s
37 Pure_Protea Cpp14 0.08s
38 zyyxxx Cpp14 0.08s
39 _Lucifer Cpp14 0.08s
40 shaft Cpp14 0.09s
41 sazal_dev Cpp14 0.09s
42 jualahmed Cpp14 0.10s
43 afzalul C 0.10s
44 souravahmed C 0.10s
45 umli Cpp14 0.10s
46 Ratul728 Cpp14 0.10s
47 ssavi Cpp14 0.12s
48 template Cpp14 0.14s
49 snow_man Cpp14 0.15s
50 Double_O Cpp14 0.15s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support