Is there any method you know

There was a Problem Called The Bytelandian Cryptographer and the problem is

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.

For a full reference
Check here: http://www.spoj.com/problems/CRYPTO1/

So I code this
1
2
3
4
5
6
7
8
9
10
11
#include <ctime>
#include <cmath>
#include <stdio.h>
using namespace std;
main()
{
long long sec = sqrt(1749870067);
while((sec*sec)%4000000007!=1749870067) ++sec;
time_t time = sec;
printf(asctime(gmtime(&time)));
}


NOTE: The above program is only made for modulus 1749870067

The Logic of my code is
The time is computed from 1970.01.01 GMT So for computing the sec from 0 to the Attack date is

So Brute Force all the number from 0 to UNTIL GET and get the answer
This is really a stupid method but can you think about any good method than please tell me.


Source : http://www.spoj.com/problems/CRYPTO1/
Last edited on
Topic archived. No new replies allowed.