Re: [gcj] Re: Round 1C: All Your Base

2018-06-07 Thread Bartholomew Furrow
I think the issue is we're supposed to assume that there are no leading zeroes, so "zig" would be 102 in base 3, or 11. On Thu, Jun 7, 2018, 09:37 Arijit Basu, wrote: > Why is it assumed that the symbols will be in alphabetical/numerical order > in alien language as they are in human language?

[gcj] Re: Round 1C: All Your Base

2018-06-07 Thread Arijit Basu
Why is it assumed that the symbols will be in alphabetical/numerical order in alien language as they are in human language? e.g. if "a" =1 why can't "b" be < 1? With this logic we get far lesser time... # Input: 11001001 0 = 1 1 = 0 1: 0 * 2^0 = 0 0: 1 * 2^1 = 2 0: 1 * 2^2 = 4 1: 0 * 2^3 = 0 0:

[gcj] Re: Round 1C - All your Base pow function

2009-09-18 Thread eSKay
cool! now i understand what the ques was about! 2^64 10^18 2^51 I completely neglected the 10^18 part in the question!! On Sep 15, 2:31 am, cyberfish cyberf...@wecheer.com wrote: The floating point version will work for integers up to about 2^51 (the width of mantissa). Beyond that

[gcj] Re: Round 1C - All your Base

2009-09-15 Thread Brian Watkins
That's a really excellent point. You could lose your chance to make your time like that. On Sep 13, 8:15 am, Damien Wintour dwint...@gmail.com wrote: minor point and irrelevant now, but the first example case in All Your Bases implies the alien language uses a left-right notation. If that

[gcj] Re: Round 1C - All your Base pow function

2009-09-14 Thread cyberfish
The floating point version will work for integers up to about 2^51 (the width of mantissa). Beyond that integers cannot be represented with perfect precision and will give you all the nastiness people have pointed out. A simple O(logn) implementation - int64 pow_int64(int64 base, int64 pow) {

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Zubair
For base 10 it was random assumption. but for base 6 see how many distinct digits you have 1 - a 2 - b 3 - 2 4 - c 5 - 9 So you have 5 distinct digits and these digits will be coverd in base 6 Just assign a unique symbol to each distinct digit and you will have it all. On Sep 13, 5:37 pm,

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Huy Phan
Actually it's 31536000 (not 31356000) and 12314555(not 1231455) as described in the problem. Let's say the input is ab2ac999 then you have ['a','b','2','c','9'] is the set of characters. We can map this set to another set : [3,1,5,6,0]. Which mean character 'a' represents for 3, 'b'-1, '2'-5

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Mahendra Kariya
Do u mean that 3ad25cda93320 will be represented as 1234563271148 in base 9 because3-1 a-2 d-3 2-4 5-5 c-6 9-7 0-8 Regards, Mahendra Kariya http://www.mahendrakariya.blogspot.com On Sun, Sep 13, 2009 at 5:20 PM, Zubair mastermind.zub...@gmail.com wrote: For base 10 it was random assumption.

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Mahendra Kariya
@Huy, do u mean the mapping is done at random and even the base is chosen randomly? Regards, Mahendra Kariya http://www.mahendrakariya.blogspot.com On Sun, Sep 13, 2009 at 5:26 PM, Huy Phan dac...@gmail.com wrote: Actually it's 31536000 (not 31356000) and 12314555(not 1231455) as described

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Huy Phan
You have to program to determine the set and the base so that your result is the minimum possible number. The result given in the problem description is just a sample and not the minimum one. Mahendra Kariya wrote: @Huy, do u mean the mapping is done at random and even the base is chosen

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Lucas Piva
On Sun, Sep 13, 2009 at 9:04 AM, Mahendra Kariya mahendrakar...@gmail.com wrote: @Huy, do u mean the mapping is done at random and even the base is chosen randomly? Those were examples. The problem asked you to the determine the mapping and base for which the message given would result in the

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Damien Wintour
minor point and irrelevant now, but the first example case in All Your Bases implies the alien language uses a left-right notation. If that assumption is wrong and they actually used right-left you'd be 54 seconds late for the war : 11001001 binary = 201 decimal, but the reverse 10010011 is 147

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Anil Kishore
Hmm, ya.. but something like that would be explicitly mentioned. All the changes from the normal system is mentioned in the question. No assumptions to be made :) nice question btw, which planet are you from ? :p - AK On Sun, Sep 13, 2009 at 6:45 PM, Damien Wintour dwint...@gmail.com wrote:

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Lucas Piva
On Sun, Sep 13, 2009 at 10:33 AM, Grant Kot kots...@gmail.com wrote: Well, considering all the international people, there are some languages that read from right to left so left to right might not be the normal system for everybody. Considering all the problems are written in English, decimal

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Grant Kot
yeah, besides i guess it wouldn't really change the algorithm much, you just have to test twice with a reverse and if you get the left to right the right to left is just redundant. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[gcj] Re: Round 1C: All Your Base

2009-09-13 Thread Mohammad Kotb
for 31356000 in base 10 it is an arbitrary representation while in case of 1231455 he made a hash where {a = '1', b = '2', 2 = '3', 4 = '4', 5 = '5'} then he created a new number with this hash so he produced 1231455 and he found that 5 is the max digit then he choosed the base 6 That's all :D

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Pedro Correia
That's a wrong assumption to make since the rules clearly say that all the problems are written in English to avoid translation problems, so We have to assume an English based rule to read and it's obvious that is from left to right. On Sun, Sep 13, 2009 at 2:33 PM, Grant Kot kots...@gmail.com

[gcj] Re: Round 1C - All your Base

2009-09-13 Thread Bartholomew Furrow
minor point and irrelevant now, but the first example case in All Your Bases implies the alien language uses a left-right notation. If that assumption is wrong and they actually used right-left you'd be 54 seconds late for the war : 11001001 binary = 201 decimal, but the reverse 10010011 is

[gcj] Re: Round 1C - All your Base pow function

2009-09-13 Thread TripleM
pow is a floating point function, not an integer function, and doubles can not always store integers exactly. It is quite possible that it returns xxx.999 rather than an exact integer, and that will round down to the wrong value. You will also get in trouble comparing doubles for the same

[gcj] Re: Round 1C - All your Base pow function

2009-09-13 Thread eSKay
http://www.cplusplus.com/reference/clibrary/cmath/pow/ http://www.cppreference.com/wiki/c/math/pow See if these links help. You can write a program that compares the values given by the pow function and your iterative function. As you know your iterative function is correct, you can probably