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.
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.
X will fit in Integer(C Int) range.
Output consist of exactly N lines of decoded form.
19 August 2000
20 December 2009
12 June 1986
23 May 1765
11 June 1567
Nguyễn Hoàng Nam:
Success in ideone but runtime error (NZEC) here
Nguyễn Hoàng Nam:
Source limit 1000B......
my code runs fine on ideone(http://ideone.com/krBYek) but it gives runtime error(NZEC) here
Date is 20 bits - 11111000110 0010 01100.
all test cases are correc but givin wrong anss..........Any tricky Case?
@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.
The real top score is
The input data is invalid; I found it contains all of: February 30, February 31, April 31, June 31, September 31, November 31.
what should be output for X=8388608
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ASM32-GCC GAWK MAWK BC C-CLANG CPP14-CLANG CLOJURE COBOL COFFEE D-CLANG D-DMD DART ELIXIR FSHARP FANTOM FORTH GO GOSU GRV JS-MONKEY KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYTHON3 PY_NBC R RACKET RUST CHICKEN SED SWIFT UNLAMBDA VB.NET|
|Resource:||Own Problem from Code Combat(RGIIT Code Competition)|