Python Programming Lab

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Python Programming Lab

Dr.D has invented yet another invention: the hateinator. He wants to test it on a group of N people (numbered 1 through N). The hateinator may be used any number of times; to use it once, Dr.D should divide these N people into two groups and press the fire button on the hateinator. We call each such grouping a Doofish set. Afterwards, there will be hatred between each two people who were in different groups. The hatred does not disappear ― any two people that hate each other before the hateinator is used still hate each other afterwards.

The hateinator uses a lot of power. Let's denote the number of times it is used by K. Then, it consumes K⋅N units of power. Dr.D cannot afford to use the hateinator if this number exceeds 106.

Dr.D has done the math and computed the most evil hatred system: a situation with some M pairs of people who hate each other. You are given these pairs. There must not be any other pair of people who hate each other. Initially, there is no hatred between these N people. Now, Dr.D is wondering: is it possible to use the hateinator to create this most evil system? If it is, what is the minimum number of times he needs to use it and with which Doofish sets? Help Dr.D find the answers. Develop a python code in not more than 100 lines to solve the problem. Below are some test cases for your assistance:

Input:

3 3

1 2

1 3

2 3

Output:

1

101

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY