+ 5
Argentina
I decide 'Argentina' In SoloLearn and I got this code. The fifth test doesn't work, what's the problem? https://code.sololearn.com/c9hlg6UfgJhT/?ref=app
15 Réponses
+ 14
A simple approach to find solution by the logic is
50 pesos= 1 dollor
+ 8
Well, lets say that we're using signed char's, whose range is -128 to 127.
If you had a number, lets say 100, and multiplied it by 2, you'd get 200 which is too big for the type to handle.
So it wraps around to -128 and starts counting from there.
The final result would be -56.
This is called overflow.
If the reverse happened, it would be called underflow.
The solution would be to use a type that has a bigger range, so that the multiplied value would be stored without causing overflow, or by changing your strategy, for example by not multiplying.
+ 6
This is a challenge from this app. It's called 'Argentina'. I can't solve it to the end.
+ 4
The 5th test causes an overflow if you multiply.
+ 3
It's hard to explain when you don't know English well
+ 3
Overflowing is like?
+ 3
Thank you, solved the problem through division, but what you're saying can come in handy later
+ 3
The Easiest code to solve this problem:
a = int(input(""))
b = int(input(""))
c = int(a / 50)
if c > b:
print("Dollars")
else:
print("Pesos")
+ 2
A regular unsigned int can only store numbers until about 2.1 billion. After that, it starts over from the bottom (-2.1 billion).
This is called overflow.
You can prevent (or rather alleviate) this problem by using a bigger number type, for example long long.
+ 1
Someone help https://www.sololearn.com/Discuss/2184619/?ref=app
+ 1
For anyone who's having trouble understanding I tried to change around the code so it's an easy read
peso = int(input())
USD = int(input())
rate = peso * 0.02
if rate > USD:
print('Dollars')
else:
print('Pesos')
0
I think there is overflow and your program doesn' t have "return 0;". Good lock
0
Hello
- 1
Remove "/" from p /=50