CODEIT03 - Play with Dates

no tags 

Play with dates

Problem Statement:

Given the date, month and year, find the day.

Input Specification:

The first line consists of an integer t, the number of test cases. Then for each test case there are three integers the date, month and year.

Output Specification:

For each test case print the day in words in a separate line(The first character should be caps followed by small letters).

Input Constraints:

1<=t<=100

Date/month/year >= 11/1/2012

Date/month/year<=31/12/3000

The given date will always be a valid date

Sample Input:

3

11 1 2012

12 1 2012

13 1 2012

Sample Output:

Wednesday

Thursday

Friday


hide comments
adityad1998: 2018-07-01 19:47:05

Read Zeller’s Congruence if you want a O(1) solution. Interesting method.

Akshat Jain: 2016-06-25 13:09:53

nice ques...had to check with my phone's calendar to make sure I m getting the correct answer in all cases...ACC in one go...:p

dwij28: 2016-01-06 03:24:50

That awkward moment when you google the spellings of the days of the week just to make sure you don't get a WA for that. :P AC at one go, I calculated the days passed since 1/ 1/ 2012 in O(1) and calculated the weekday using the fact that 1/ 1/ 2012 was Sunday.

sumit suthar: 2015-11-15 08:36:01

Ac in one go ;)
concept of odd days ;)

Tim Wargon: 2015-10-21 13:25:07

now i will never forget the logic behind leap years :) AC !

Ajay Pilaniya: 2015-08-23 01:04:59

Problem is easy but implementation is hard

anuveshkothari: 2015-07-27 13:24:25

same logic.. WA in java ..accepted in C++..

vasayashwanth: 2015-07-22 15:20:25

too easy....check for leap years....

karthik1997: 2015-07-13 04:21:53

Acin 1st go :D 0.0s
Reminder: take care of input constraints and design your code . it is enough . no need to find the day from 01/01/0001 :p
i didnt use any algo but only bruteforce :) check it out for clarity :p
http://ideone.com/XOkAdt

Last edit: 2015-07-13 04:30:09
Shubhransh Srivastav: 2015-07-12 19:27:23

http://www.spoj.com/submit/CODEIT03/id=14655301
wa always though getting test cases correct.. someone help plz :(


Added by:cegprakash
Date:2012-01-09
Time limit:0.375s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All