GUESSLNK - Number Guessing Game 2
I really enjoy setting problem GUESSING. After three years, I decided to set another "kind of interactive" problem based on it.
Given a link for GUESSING problem, find the server's response
Specification
The script runs on server works like this, the URL contains 12 digits, first 6 digits represents SEED generated by random number generator, and it won't change during a guessing session. The last 6 digits represents GUESS, which is the number user just typed.
The unknown part (for you, of course) is an integer function f which is a bijection from [0,999999] to [0,999999].
The server first generate TARGET = f(SEED), then it compares TARGET and GUESS and give response back to user.
for more details on f, it's in format (expr(x) % 1000000), and expr (x) is a expression contains only operation add, subtract, multiply, division, modulo, each exactly once, and every constants are in [0,999999], every variable is x(of course), brackets are allowed.
for example, expr(x) could be "x/12-34%(x+1)*56", but it's invalid since f is not a bijection.
the modulo/division operations here works well if left side is a negative number, for example, -2 % 5 = 3, -2 / 5 = -1. but it's undefined if the number on the right side is not positive.
Input
each line contains a link in format "http://www.spoj.com/problems/GUESSING/XXXXXXYYYYYY/", where XXXXXXYYYYYY contains exactly 12 digit.
Output
The server's response, in format "XAYB".
Example
Input: http://www.spoj.com/problems/GUESSING/123456123456/ http://www.spoj.com/problems/GUESSING/000000000000/ Output: 1A3B 1A5B
hide comments
abhu:
2018-11-08 20:59:33
@Bin Jin , 22669739 . I am sure of the logic now. Seed being (****) => 8_ and a perfect square. So can you see where I am going wrong? |
|
darragh:
2016-03-26 19:25:36
Remember that the target can have leading 0's. Cost me two WA. |
|
shravinson:
2015-08-30 15:16:36
impossible pattern matching.....
|
|
Sumit Paroothi:
2015-07-10 07:02:58
seemed impossible at one point.... |
|
noobe:
2015-03-16 16:27:58
plz can you help me with my solution id 13735600 |
|
Tushar:
2014-07-12 21:01:01
how can 000000 give 1A5B.. does it makes sense.. or im missing on something? |
|
Ishan Bansal:
2013-10-16 21:49:30
does the test cases end with EOF
|
|
Sidharth Gupta:
2011-07-05 11:49:33
Simply awesome!! Really enjoyed it. Would love to see more of these :):) |
|
:D:
2011-06-07 04:38:59
Nice idea for a problem, cracking another problem :) |
Added by: | Bin Jin |
Date: | 2011-06-06 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |