A scientist has created a writing bot, which will read from one book and write into another. Both books may have different dimensions.i.e. number of lines on each page and number of pages itself. Read and Write also happen at different speeds.
The bot first reads from the first book fully, then processes the format to write into the second book(done instantaneously) and finally starts writing into the second book.
Your task is to identify, after a specified interval of time, if the bot is reading or writing.
For each of these activities how much read and write activity has happened needs to be captured in terms of pages and number of pages and number of lines on the current page.
Input:
Input has 7 lines
->The first line contains an integer denoting the number of pages in the first book.
->The second line contains an integer denoting the number of lines per page of the first book.
->The third line contains an integer denoting the number of pages in the second book.
->The fourth line contains an integer denoting the number of lines per page of the second book.
->The fifth line contains an integer denoting the reading speed in lines/second.
->The sixth line contains an integer denoting the writing speed in lines/second.
->The seventh line contains integers denoting the time in seconds at which the results are to be processed.
Output:
On one time, print three items.
Current activity performed (READ OR WRITE),
Page number, Line number.
All three items should be delimited by space.
Np1=int(input("Enter the No: of pages in the First Book: ")) #the number of pages in the first book. Nl1=int(input("Enter the No: of lines per page of the First Book: ")) #the number of lines per page of the first book. Np2=int(input("Enter the No: of pages in the Second Book: ")) #the number of pages in the second book. Nl2=int(input("Enter the No: of lines per page of the Second Book: ")) #the number of lines per page of the second book. Rs=int(input("Enter the reading speed in lines per second: ")) #the reading speed in lines/second. Ws=int(input("Enter the writing speed in lines per second: ")) #the writing speed in lines/second. Tot=int(input("Enter the time in seconds at which the results are to be processed: ")) #the time in seconds at which the results are to be processed. totlines1=Np1*Nl1 totlines2=Np2*Nl2 secs=totlines1/Rs if (Tot-secs)>=0: d=Tot-secs linesw=d*Ws Pnumb=int(linesw/Nl2) Remlines=int(linesw%Nl2) print("WRITE {} {}".format(Pnumb,Remlines)) else: linesr=Tot*Rs Pnumb=int(linesr/Nl1) Remlines=int(linesr%Nl1) print("READ {} {}".format(Pnumb,Remlines))
Input:
Enter the No: of pages in the First Book: 100
Enter the No: of lines per page of the First Book: 10
Enter the No: of pages in the Second Book: 500
Enter the No: of lines per page of the Second Book: 6
Enter the reading speed in lines per second: 8
Enter the writing speed in lines per second: 4
Enter the time in seconds at which the results are to be processed: 145
Output:
WRITE 13 2 (current activity, page number, line number)
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer