CODEIT03 - Play with Dates

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

Input

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

Output

For each test case print the day in words in a separate line (the first character should be capitalised followed by lowercase).

Constraints

1 ≤ t ≤ 100

Date/month/year ≥ 11/01/2012

Date/month/year ≤ 31/12/3000

The given date will always be a valid date.

Example

Input:
3
11 1 2012
12 1 2012
13 1 2012

Output:
Wednesday
Thursday
Friday

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

hide comments
2023-11-16 03:01:43
@cegprakash Isn't there any invalid date? I use the Kim Larson F/A and output none when the date is invalid such that 29 2 2013 cost me 1 WA... When I delete this special judge to invalid dates and my program output Friday for previous sample, it got AC. Therefore, please check the test case and figure out if there is any invalid date in it.

Added by myself: My program runs well in https://www.spoj.com/problems/CLOCK1/ , so I think you shouldn't doubt the correctness of the F/A or the program.

Reply by author: There is no test case with 29 as the date for February month in the judge. You can add a check for the same to verify this if you have an AC solution. I initially created a simple generator to avoid these issues.

Last edit: 2024-03-06 16:58:22
2018-07-01 19:47:05
Read Zeller’s Congruence if you want a O(1) solution. Interesting method.
2016-06-25 13:09:53 Akshat Jain
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
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.
2015-11-15 08:36:01 sumit suthar
Ac in one go ;)
concept of odd days ;)
2015-10-21 13:25:07 Tim Wargon
now i will never forget the logic behind leap years :) AC !
2015-08-23 01:04:59 Ajay Pilaniya
Problem is easy but implementation is hard
2015-07-27 13:24:25
same logic.. WA in java ..accepted in C++..
2015-07-22 15:20:25
too easy....check for leap years....
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


Last edit: 2022-06-23 20:24:18
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.