Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Augustus is the first king of the Roman kingdom.The Kingdom is now surrounded by enemies.the king wants to set his army all over the perimeter
Augustus is the first king of the Roman kingdom.The Kingdom is now surrounded by enemies.the king wants to set his army all over the perimeter of the kingdom to defend it from enemies. The whole area is divided into number of blocks.given a map of M N blocks,where indicates Augustus's kingdom and all the other positive numbers indicate the enemies present in that particular block.The enemies present on all sidesleft right,updown,and diagonals of the perimeter are ready to attack the kingdom. King is preparing a war plan to defend the kingdom.Help the king by finding the number of enemies ready to attack the kingdom.
Write a java program that reads a matrix MN which represents the map and prints the number of enemies ready to attack the kingdom. First line of input contains two spaceseparated integers representing M and N respectively. The next M lines of input contains N spaceseparated integers..write a java program
for this problem immediately.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started