Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use python to write it Fido? 17:10 a cemc.uwaterloo.ca Problem J4: Favourite Times Time limit 1 second Problem Description Wendy has an LED clock

please use python to write it image text in transcribed
image text in transcribed
Fido? 17:10 a cemc.uwaterloo.ca Problem J4: Favourite Times Time limit 1 second Problem Description Wendy has an LED clock radio, which is a 12-hourelock, displaying times from 12:00to11:59 The hours do not have leading eros burt minutes may have lcading zeos sach as 2107 or 11103 When looking at her LED clock radio, Wendy likes to spot arithmetic sequences in the digits For example, the imes 12134 and 2146 are some of her favouriae times, since the digits form an arithmetic sequence A sequence of digits is an aninnenic sequence if each dipit after the firt dipn is obtained by adding a constant common difference. For example. 12.34 is an arithmetic sequence with a common difserence of 1, and 246 is an anithmeis sequence w ith a common difference of 2 Suppose that we art looking at the clock at noon (that B, when it reads 12:00) and watch the clock for some number of minutes How many instances e here such that the time displayed on the clock has the progerty that the digits form an arihmetic soqaencet Input Specification The input contains one intcgcr D (OSDS1000 000 000L which ropecnsents the duration th the For 4 of the 15 available maks, D S 10000 Output Specification Output the number of times that the clock displays a time where the digits foms an anithmetisc sequence starting from noon (12100) and ending after D minutes have passed, possibly including the ending time Sample Input I 34 Output for Sample Iput 1 Explanation of Output for Sample Inpat Between 12:00 and 32:34, there is only the time 12:34 Sor which the digits fom an arithmctic Scquence Sample Input 2 180 Output for Sample Input 2 Version francaise som aps la version anglabe Explanation of Output for Sample Inpat 2 Between 12:00 and 3 :00, the following times foem anithmetic sequences in their dipits (with the difference shown: 12:34 flerence I1 56 Explanation of Output for Sample Input 2 Between 12:00 and 3:00, the following times form arithmetic sequences in their digits (with the difference shown: 12:34 (difference l), 1:11 (difference 0). . 1:23 (difference 1). 1:35 (difference 2), 1:47 (difference 3) 1:59 (difference 4 .2:10 (difference-1 . 2:22 (difference 0), .2:34 (difference 1) 2:46 (difference 2), . 2:58 (difference 3)

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions