Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem J3: Exactly Electrical Time limit: 1 second Problem Description You live in Grid City, which is composed of integer-numbered streets which run east-west (parallel

image text in transcribed
image text in transcribed
Problem J3: Exactly Electrical Time limit: 1 second Problem Description You live in Grid City, which is composed of integer-numbered streets which run east-west (parallel to the r-axis) and integer-numbered avenues which run north-south (parallel to the y-axis). The streets and avenues have infinite length, and there is a street for every integer y-coordinate and an avenue for every r-coordinate. All intersections are labelled by their integer coordinates: for example, avenue 7 and street -3 intersect at (7.-3) You drive a special electric car which uses up one unit of electrical charge moving between adjacent intersections: that is, moving either north or south to the next street, or moving east or west to the next avenue). Until your battery runs out, at each intersection, your car can turn left, turn right, go straight through, or make a U-turn. You may visit the same intersection multiple times on the same trip Suppose of electrical charge in your battery. Determine whether you can travel from the starting intersection to the destination intersection using the charge available to you in such a way that your battery is empty when you reach your destination. you know your starting intersection, your destination intersection and the number of units Input Specification The input consists of three lines. The first line contains a followed by b, indicating the starting coordinate (a, b) (-1000 a 1000;-1000 b 1000). The second line contains c followed by d, indicating the destination coordinate (c, d) (-1000 S c 1000,--1000-d 1000). The third line contains an integer t (0 t electrical charge of your battery 10000) indicating the iniial number of units of For 3 of the 15 available marks, 0 a, b, c,d 2. For an additional 3 of the 15 marks available, t 8 Output Specification Output Y if it is possible to move from the starting coordinate to the destination coordinate using exactly t units of electrical charge. Otherwise output N use python to solve it

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions