A Jhinuk and her grandma have a special bond, they love playing puzzle games together. One day, grandma came up with a new game for Jhinuk to play. She found some old wooden blocks and put them together in a 3xN grid. Problem A A Game with Grandma To make the game more fun, grandma made up some imaginary rules: two players take turns picking a 2x2 section of the grid to color, with the rule that each cell can only be colored once. The player who can no longer pick a 2x2 section to color loses the game. The game sounded easy to Jhinuk, but there was a catch. Some of the blocks were cracked and couldn't be painted! Jhinuk and her grandma are both smart and play well, so they will never make a wrong move if there is a way to win. Can you write a code to figure out who will win given the starting state of the board? Grandma always lets Jhinuk go first 'cause she loves her so much. To help you write the code, she has provided you with some sample boards. 0000 0000 33 00000 00x00 00000 Winner Jhinuk langatant: Association Pret Winner hink Winner Grandma Input The first line will contain a single integer T (1 ≤ T ≤ 300). The first line of each test case contains N (1 ≤ N ≤ 100) representing the size of the grid. Each test case will contain 3 lines of the same length, representing 3 rows of blocks. Each block is represented by a character "O" or "X" indicating a good block or a damaged block respectively. Output For each case, print the case number and the winner of the game - "Jhinuk" or "Grandma". Sample Input Output for Sample Input Case 1: Jhinuk Case 2: Jhinuk Case 3: Grandma

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
A
?
Jhinuk and her grandma have a special bond, they love playing puzzle games together. One day, grandma
came up with a new game for Jhinuk to play. She found some old wooden blocks and put them together in
a 3xN grid.
Problem A
A Game with Grandma
To make the game more fun, grandma made up some imaginary rules: two players take turns picking a 2x2
section of the grid to color, with the rule that each cell can only be colored once. The player who can no
longer pick a 2x2 section to color loses the game.
The game sounded easy to Jhinuk, but there was a catch. Some of the blocks were cracked and couldn't
be painted!
Jhinuk and her grandma are both smart and play well, so they will never make a wrong move if there is a
way to win. Can you write a code to figure out who will win given the starting state of the board?
Grandma always lets Jhinuk go first 'cause she loves her so much. To help you write the code, she has
provided you with some sample boards.
000
000
000
4
0000
0000
0000
5
Winner Jhinuk
00000
00x00
00000
Winner ink
Baga
Association
Prem
GG
GG
Winner Grandma
Input
The first line will contain a single integer T (1ST ≤ 300). The first line of each test case contains N (1 ≤ N ≤
100) representing the size of the grid. Each test case will contain 3 lines of the same length, representing 3
rows of blocks. Each block is represented by a character "0" or "X" indicating a good block or a damaged
block respectively.
Output
For each case t the case number and the winner of the game - "Jhinuk" or "Grandma".
Sample Input
Output for Sample Input
Case 1: Jhinuk
Case 2: Jhinuk
Case 3: Grandma
Transcribed Image Text:A ? Jhinuk and her grandma have a special bond, they love playing puzzle games together. One day, grandma came up with a new game for Jhinuk to play. She found some old wooden blocks and put them together in a 3xN grid. Problem A A Game with Grandma To make the game more fun, grandma made up some imaginary rules: two players take turns picking a 2x2 section of the grid to color, with the rule that each cell can only be colored once. The player who can no longer pick a 2x2 section to color loses the game. The game sounded easy to Jhinuk, but there was a catch. Some of the blocks were cracked and couldn't be painted! Jhinuk and her grandma are both smart and play well, so they will never make a wrong move if there is a way to win. Can you write a code to figure out who will win given the starting state of the board? Grandma always lets Jhinuk go first 'cause she loves her so much. To help you write the code, she has provided you with some sample boards. 000 000 000 4 0000 0000 0000 5 Winner Jhinuk 00000 00x00 00000 Winner ink Baga Association Prem GG GG Winner Grandma Input The first line will contain a single integer T (1ST ≤ 300). The first line of each test case contains N (1 ≤ N ≤ 100) representing the size of the grid. Each test case will contain 3 lines of the same length, representing 3 rows of blocks. Each block is represented by a character "0" or "X" indicating a good block or a damaged block respectively. Output For each case t the case number and the winner of the game - "Jhinuk" or "Grandma". Sample Input Output for Sample Input Case 1: Jhinuk Case 2: Jhinuk Case 3: Grandma
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 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