DDATE - Dos Date
In DOS, current date is stored in encoded form to reduce the space. Date is encoded in a single integer number. The binary form of the number can be divided to decode the date parameters.
Date is a sequence of 23 bits. First 14-bits for year, next 4-bits for month and finally 5 bits for date.
e.g., 12 February 1990 can be encoded as -
1990 02 12 ---> (11111000110 0010 01100) Binary Form
---> (1018956) Decimal Form
Your task is simple. You only will have to decode date from the given decimal encoded form. Score is source length.
Input
The input consists of N cases (equal to about 1000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with one positive integer X. This integer X is the encoded form which is to be decoded.
1<=N<=1000
X will fit in Integer(C Int) range.
Output
Output consist of exactly N lines of decoded form.
Example
Input:
5
1024275
1029012
1017036
903863
802507
Output:
19 August 2000
20 December 2009
12 June 1986
23 May 1765
11 June 1567
hide comments
Nguyễn Hoàng Nam:
2016-02-02 08:05:34
Success in ideone but runtime error (NZEC) here |
|
Nguyễn Hoàng Nam:
2016-02-02 06:06:39
Source limit 1000B...... |
|
One_touch_finish:
2014-01-13 12:48:58
my code runs fine on ideone(http://ideone.com/krBYek) but it gives runtime error(NZEC) here |
|
nadavishe:
2013-10-31 13:31:35
Date is 20 bits - 11111000110 0010 01100.
|
|
bicky:
2013-06-12 18:12:07
all test cases are correc but givin wrong anss..........Any tricky Case? |
|
XeRoN!X:
2013-05-22 19:40:56
@Mitch, I didn't find alternative to something specific i am using in my solution, will certainly look for it to match up to that 50B solution in shorten. |
|
Mitch Schwartz:
2013-05-17 21:41:05
The real top score is |
|
Mitch Schwartz:
2012-12-28 04:48:33
The input data is invalid; I found it contains all of: February 30, February 31, April 31, June 31, September 31, November 31.
|
|
NZEC:
2012-08-03 17:45:46
what should be output for X=8388608
|
|
Hasan0540:
2012-08-02 23:14:10
@muhamed_hafez
|
Added by: | Aragorn |
Date: | 2010-02-14 |
Time limit: | 1s |
Source limit: | 1000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32-GCC GAWK MAWK BC C-CLANG NCSHARP CPP14-CLANG CLOJURE COBOL COFFEE D-CLANG D-DMD DART ELIXIR FSHARP FANTOM FORTH GO GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PYTHON3 PY_NBC R RACKET RUST CHICKEN SED SWIFT UNLAMBDA VB.NET |
Resource: | Own Problem from Code Combat(RGIIT Code Competition) |