Can you tell me, if I'm not asking much, where did i do wrong in my solution for this problem on past competition? Tnx
paycheck
The problem is in the following line:
the division there is integer division - meaning if you have s1 = 3 and s2 = 1 you will get s1/s2 = 1 and not 1.5
writeln(s1/s2:0:2);the division there is integer division - meaning if you have s1 = 3 and s2 = 1 you will get s1/s2 = 1 and not 1.5
But on my computer it displayed real numbers
Well, it depends what compiler you are using. But according to standard pascal, it should NOT display real numbers.
AFAIK, 3/1 is 1 :P
BUt it did, not my fault. Never mind.
Miloše,
Your mistake is: You were used integer type in your code. This is not enough to receive all data in s1 and s2.
Put LongInt instead, and I'm sure that then will be OK.
Your mistake is: You were used integer type in your code. This is not enough to receive all data in s1 and s2.
Put LongInt instead, and I'm sure that then will be OK.