Mayan Calculation puzzle discussion

I refer to the Constraints section:

0 < L, H < 100
0 < S1, S2 < 1000
The remainder of a division is always 0.
The mayan numbers given as input will not exceed 2**63.

I realy enjoyed it when solving.

I don’t know what is happening. I was able so solve the puzzle and have 100% however when I tried submit the results they weren’t loading so I tried to refresh and go backwards and it appears that I have 0% progress and now I’m afraid I lost everything.

I had an issue with the test “Base20”.
The problem I was facing was not because I was not reading all of values from the dictionary.

The issue was in the conversion from base 20 to base 10:
Instead of starting doing a multiplication with 20^(0…n), I was doing it with 20^(1…(n-1))

I want to emphasize that all other tests where passing but that one.
I hope it can help

I don’t understand how we find the power of 20 ???

RE: Base20 validation case issue: Perhaps this was already addressed, but in case it wasnt…

I was was struggling with this for a bit… I realized that I wasn’t building the 20th index into my dictionary (< vs <= issue). It seems like the unique aspect here is that this the only test to actually indexes the 20th numeral.

I seem to have a completely different issue. I’m using C++ and I’ve tried multiple lengths of integer all the way up to unsigned long long, and yet when I multiply the numbers on one of the tests,

I get:
12345 * 789012 = 1150418548

When it should be:
12345 * 789012 = 9740353140

Any ideas?

Perhaps you haven’t declared the product variable as unsigned long long? I got 1150418548 from the code below:

#include <iostream>
using namespace std;
int main() {
    unsigned long long a, b;
    a = 12345;
    b = 789012;
    unsigned int c; // should be unsigned long long
    c = a * b;
    cout << c << endl;
}

I get that same answer with a standard int as well. But like I mentioned, changing it to a long long (unsigned or not) seems to yield the same result.

Did you try running the above code with the commented line changed to:

    unsigned long long c; // should be unsigned long long

? It works for me.

If it doesn’t work for you for some reason, there must be a bug elsewhere in your code.

I found the issue. In the above example, all 3 variables were long long. In mine, C was long long, but a & b were still int - apparently, even though a & b were within the limits of int, they couldn’t multiply high enough before storing in c.

1 Like

In this example Input section, 10 is incorrect.

I tried solving this in Rust, but I’ve encountered an issue.

The symbol to be decoded does not match any of the provided Maya symbols.

For example, in the second test “Addition with carry” (H=4 and L=4), I have the following Maya symbols:

SYMBOL 0
'.oo.'
'o..o'
'.oo.'
'....'
SYMBOL 1
'oo.o'
'..o.'
'oo..'
'....'
SYMBOL 2
'o.o.'
'.o..'
'o...'
'....'
SYMBOL 3
'.o..'
'o...'
'....'
'....'
SYMBOL 4
'o...'
'....'
'....'
'....'
SYMBOL 5
'...o'
'....'
'....'
'....'
SYMBOL 6
'..oo'
'....'
'....'
'....'
SYMBOL 7
'.oo.'
'....'
'....'
'....'
SYMBOL 8
'oo..'
'....'
'....'
'....'
SYMBOL 9
'o..o'
'....'
'....'
'....'
SYMBOL 10
'..oo'
'....'
'....'
'....'
SYMBOL 11
'.ooo'
'....'
'....'
'....'
SYMBOL 12
'ooo.'
'....'
'....'
'....'
SYMBOL 13
'oo.o'
'....'
'....'
'....'
SYMBOL 14
'o.oo'
'....'
'....'
'....'
SYMBOL 15
'.ooo'
'....'
'....'
'....'
SYMBOL 16
'oooo'
'....'
'....'
'....'
SYMBOL 17
'ooo.'
'..._'
'....'
'....'
SYMBOL 18
'oo..'
'..__'
'....'
'....'
SYMBOL 19
'o...'
'.___'
'....'
'....'

And S1 is provided as:

S1, number of lines : 4
 line 0 is 'ooo.'
 line 1 is '____'
 line 2 is '____'
 line 3 is '____'

I suspect the dictionary being used is just the default one from the problem description.

Furthermore, the expected result for the second test is 84 (4 times 20^1 + 4 times 20^0).

This suggests the operator provided is also incorrect. The input read is "+", but if S1 and S2 each consist of only one Maya digit, the maximum sum possible is 38 (19 + 19).

It seems like the test should actually be:

  • S1 = 7 (currently not found)

  • S2 = 12 (matches Maya symbol 12)

  • Operator: “*” (instead of “+”)

Refer to the input; it seems that you’ve extracted the wrong symbols:

.oo.o...oo..ooo.oooo....o...oo..ooo.oooo....o...oo..ooo.oooo....o...oo..ooo.oooo
o..o................____________________________________________________________
.oo.....................................________________________________________
............................................................____________________

I hadn’t considered that possibility. I will double-check that section. Thank you."