Programming Geek
Rated 4.7/5 based on 1446 reviews

CodeVita 2016 Round 2 Question: The Mystery of Sky

Problem : The Mystery of Sky


Statement

Stark is a 10 year old kid and he loves stars. So, he decided every day he will capture a picture of a sky. After doing this for many days he found very interesting observations.

Every day the total number of stars in the sky is same as days completed for a calendar year. He noticed, on Saturday's and Sunday's that there are no stars in the sky. Stark's camera does not have wide angle capture feature so he could only capture maximum of 50 stars at a time. So, he assumed that there are only 50 stars in the sky that day. Also, the camera discharges every 4th day and he is not be able to click any picture that day. So let's say, if the first day of calendar (01/01/0001) starts on a Monday then on Thursday he can't click any pictures. Then resuming on Friday he can take pictures until Sunday, but can't take picture on Monday, followed by downtime on Friday, then Tuesday, then Saturday etc. When the camera discharges he considers 0 stars that day.

You are his programmer friend and want to help him. You need to write a code which will tell him on a particular date how many stars Stark's camera was able to click.

You can assume Stark has an ancient camera and your first input will be the day for date (01/01/0001) and then followed by any date on which Stark wants to find out the number of stars in the sky.
Input Format:

Every line of input will contain a Day at date 01/01/0001 in dd/mm/yyyy format followed by a Date in the same format (on which we have to count the stars)
Output Format:
For valid Input
Count of the number of stars in the sky on the given date

For Invalid Input
Print "Invalid Date" for invalid date

Print "Invalid Day" for invalid day


Sample Input and Output

SNo.InputOutputExplanation
1
Monday
30/02/1990

Invalid Date

2
Thursday

Invalid Day 

3
Wednesday
24/01/2056 

24

Its 24th day of the year and neither is Saturday/Sunday nor has the camera discharged on this day.

No comments :

Post a Comment