YEARDAY - Day of the year
You want to know how many days there have been so far this year.
As a reminder (just in case you forgot the mnemonic), January, March, May, July, August, October, and December have 31 days. April, June, September, and November have 30 days. February has 28 days on non-leap years and 29 days on leap years.
A year is a leap year if:
The year is divisible by 4 UNLESS the year is divisible by 100 UNLESS the year is divisible by 400.
So 2000 and 2004 are leap years, but 2100 is not.
Input
A date in format MM/DD/YYYY.
Output
The day of the year (where 01/01/YYYY is day 1 of the year).
Examples
Input: 11/07/2015 Output: 311
Input: 04/20/1992 Output: 111
Input: 03/22/1624 Output: 82
Input: 01/23/1381 Output: 23
Added by: | BYU Admin |
Date: | 2015-11-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: MAWK BC NCSHARP COFFEE DART FORTH GOSU JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |