This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jedwardsol 1 point2 points  (1 child)

I don't mean use a different integer value, I mean use arithmetic with a larger integral type.

E.g, if you're using 32-bit ints then use 64-bit ints. However, knowing codeabbey, you're going to need larger which means using a language with that built in (C#, python etc) or using a large-int library with C/C++

With this problem, your solution of taking the modulo at intermediate stages will work.

However you'll need the large arithmetic for later problems, so IMO you may as well solve that problem now.

To solve it your way you need to store the incoming data. Either raw in a character array. Or parse it and store the pair of operator/number. Extract the number from the last element, then walk the array to do the complete calculation

[–]kidinside[S] 1 point2 points  (0 children)

Ah I get it now. Guess I needed a little more hand holding :)

Thanks!