Q2: Kiki's Cards Kiki is making "IHappy National Pizza Day" (Fehruary gth) cards for all of her friends. She's a bit disappointed with the cards not looking special enough, so she decides to add glitter to them to make them look more special. IHowever, she's short on glitter, so she decides to add glitter selectively. She uses a box with N- Ndivided sections to store her cards. Each section is huge and each card is small, so she can put multiple cards in a given section and they will never overlap. We model the way that she organizes the cards and adds glitter using two commands: • Command 1: 1 x y add a card to the bax in section (x, y). • Command 2: 2 x1 y1 x2 y2 Add one unit of glitter to cach of the cards in the sections from (xa. ya) to (x2. y2). IHelp Kiki determine the total number of units of glitter that she placed on the cards. Filename Your filename for this question must be a2.py. Input The first line will contain N (1 -NC- 500) and C(1<-c- 500 ), the square size of the card storage box and the number of commands. The next e lines will contain one of the commands listed above. Command 1 will contain x (1 <- xc- N) and y(1 <-yc- N), the coordinates where a new card will be added. Command 2 will conatain x1, y1, x2, and y2 (1<-x1 <- x2 <- N, 1 <- y1 <- y2 <- N), a rectangle of sections where one unit of glitter is added to all the cards. Output Output the total number of units of glitter placed on the cards. Sample Input 1 123 155 22355 131 22331 22355 Sample Output 1
Q2: Kiki's Cards Kiki is making "IHappy National Pizza Day" (Fehruary gth) cards for all of her friends. She's a bit disappointed with the cards not looking special enough, so she decides to add glitter to them to make them look more special. IHowever, she's short on glitter, so she decides to add glitter selectively. She uses a box with N- Ndivided sections to store her cards. Each section is huge and each card is small, so she can put multiple cards in a given section and they will never overlap. We model the way that she organizes the cards and adds glitter using two commands: • Command 1: 1 x y add a card to the bax in section (x, y). • Command 2: 2 x1 y1 x2 y2 Add one unit of glitter to cach of the cards in the sections from (xa. ya) to (x2. y2). IHelp Kiki determine the total number of units of glitter that she placed on the cards. Filename Your filename for this question must be a2.py. Input The first line will contain N (1 -NC- 500) and C(1<-c- 500 ), the square size of the card storage box and the number of commands. The next e lines will contain one of the commands listed above. Command 1 will contain x (1 <- xc- N) and y(1 <-yc- N), the coordinates where a new card will be added. Command 2 will conatain x1, y1, x2, and y2 (1<-x1 <- x2 <- N, 1 <- y1 <- y2 <- N), a rectangle of sections where one unit of glitter is added to all the cards. Output Output the total number of units of glitter placed on the cards. Sample Input 1 123 155 22355 131 22331 22355 Sample Output 1
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...
Related questions
Question
100%
Help.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY