There are exactly N people living in a certain parallel universe. The Ith of these N people claim to be the parent of exactly Ai off these N people. However, some of these people may be lying - the person may either be telling the truth (in which case they have exactly Ai children) or lying down (in which case they can have any number of children). It is known that each person has at most one parent. Furthermore, as one would expect, a person's child is not allowed to also be their ancestor. What is the maximum possible number of truth tellers in this universe

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question
Using Python programming language.
There are exactly N people living in a certain parallel universe. The Ith of these N
people claim to be the parent of exactly Ai off these N people.
However, some of these people may be lying - the person may either be telling the
truth (in which case they have exactly Ai
children) or lying down (in which case they can have any number of children).
It is known that each person has at most one parent. Furthermore, as one would
expect, a person's child is not allowed to also be their ancestor. What is the
maximum possible number of truth tellers in this universe
Required Output
2
Possible input
1
2
10
Transcribed Image Text:Using Python programming language. There are exactly N people living in a certain parallel universe. The Ith of these N people claim to be the parent of exactly Ai off these N people. However, some of these people may be lying - the person may either be telling the truth (in which case they have exactly Ai children) or lying down (in which case they can have any number of children). It is known that each person has at most one parent. Furthermore, as one would expect, a person's child is not allowed to also be their ancestor. What is the maximum possible number of truth tellers in this universe Required Output 2 Possible input 1 2 10
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Turing Machines
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning