Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
2018-11-08 20:59:33 abhu
@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? |
|
2016-03-26 19:25:36
Remember that the target can have leading 0's. Cost me two WA. |
|
2015-08-30 15:16:36 shravinson
impossible pattern matching..... how can anyone guess pattern behind this question...... (-.-) |
|
2015-07-10 07:02:58 Sumit Paroothi
seemed impossible at one point.... |
|
2015-03-16 16:27:58 noobe
plz can you help me with my solution id 13735600 |
|
2014-07-12 21:01:01 Tushar
how can 000000 give 1A5B.. does it makes sense.. or im missing on something? |
|
2013-10-16 21:49:30 Ishan Bansal
does the test cases end with EOF EDIT:- AC :D if first input is |
|
2011-07-05 11:49:33 Sidharth Gupta
Simply awesome!! Really enjoyed it. Would love to see more of these :):) |
|
2011-06-07 04:38:59 :D
Nice idea for a problem, cracking another problem :) |