Question: Problem 3 Input specification: The input consists of three lines. The first line contains two integers p and a r , separated by space. The
Problem
Input specification: The input consists of three lines. The first line contains two integers p and a r separated by space. The second line contains integers s s sp separated by spaces. The third line contains integers t t tr separated by spaces. You may assume that the integers are positive and fit in int. You may also assume that p and r are nonnegative and not larger than
Output specification: The output contains a single line with the word YES or NO depending on whether the replanting is possible or not.
Sample input: input input input input input input input input
Sample output: answer answer answer answer answer answer answer answer
How to submit: Name your files Planters.java or Planters.cpp
Your programs must be written in Java
Do not use any Java packages other than java.math, java.io and java.util.Scanner. In particular, note the absence of any data structures and algorithms from java.util in this list!
All input will be from standard input and output to standard output, as described in each assignment. In particular, the inputoutput does not come fromgo to a file! You must not provide any prompting or print anything else on standard output. Note that on most operating systems, you can redirect the contents of a file to appear on standard input, such as java MyProg inputfile.txt or aout inputfile.txt This way you can test your code by including your input in a file and having it appear as if someone typed it on their keyboard the sign is very important here it does the redirecting If you want to store the output of your code in a file, you can also use redirect: java MyProg inputfile.txt myoutput.txt or aout inputfile.txt myoutput.txtYour algorithm's running time should be independent of the bounds we state in the html specification of the inputoutputA bit more on this: in homeworks we will provide a pdf description of the problem statements, and an html description of the inputoutput specifications and bounds. If in the pdf as part of the problem statement, we say that, for example, the input consists only of values you can and probably will need to rely on this to get the required running time. On the other hand, the bounds in the html descriptions are merely to help you with coding, to estimate the size of the needed data structures, time limits and so on Do not rely on these in the design of your algorithm.
You do not have to check for the correctness of the input it will always follow the described specification.
Write your programs neatly imagine yourself grading your program and see if it is easy to read and understand. Comment your programs reasonably: there is no need to comment lines like i but do include brief comments describing the main purpose of a specific block of lines eg merging two sorted arrays" if implementing the merge function in MergeSort
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
