CRYPTO1 - The Bytelandian Cryptographer (Act I)
The infamous Bytelandian Bit-eating Fanatic Organisation (BBFO for short) plans to launch an all-out denial-of-service attack on the Bytelandian McDecimal's fast food network by blocking the entrance to every restaurant with a camel (the purpose being to rid the Organisation of unhealthy competition, obviously). In a sly and perfidious move, the head cryptographer of BBFO decided to disclose the date and time of the planned attack to the management of McDecimal's, but in encrypted form (ha ha). He calculated the number of seconds from midnight 1970.01.01 GMT to the moment of attack, squared it, divided it by 4000000007 and sent the remainder by e-mail to McDecimal's. This made the original date impossible to decode.
Or did it?
You work as the head algorthimist at McDecimal's HQ and know nothing of what is happening in Byteland. Things are not going well. You are playing a quiet game of hearts against your computer and wondering why on earth Management are considering making you redundant. Suddenly, the CEO bursts into your office, saying:
- Look here, young man[lady]! I have this number and those guys claim it is supposed to be some date. I am giving you one second to tell me what it all means!
I am afraid you have no choice. You can't ask any further
You just have to answer, now.
The encrypted timestamp.
The decrypted GMT time and date of attack, somewhere between 1970 and 2030, using standard 26 character formatting.
Sun Jun 13 16:20:39 2004
Easy in python
make sure that you use unsigned long long as the data type for the variables!!Last edit: 2015-10-31 05:36:21
can we use tonelli shanks algorithm for this? or any different algorithm is there?
Nice Question !!
For given input, I have Jun 13 18:20:39 2004 for output (1087143639 in seconds). Is this correct? I see 1087143639 is solution by more users
yeah it is....
Very nice question.
SPOJ GHC (6.10) is way too old and seems broken, sometimes is very painful to spend time on unwanted stuff because seems nobody even have GHC 6.10 installed. I got AC with below function to convert time:
I submitted a solution in haskell and it fails to compile because the system lacks "Data.Time.Format", can somebody tell me how to proceed?Last edit: 2014-08-25 02:58:18
Do I have to write e.g. 00:02:05?