in reply to Re^3: Input data problem
in thread Input data problem
my $data = <STDIN>; my (@data) = split (" ", $data); my $n = shift (@data); my $m = shift (@data); my $a = shift (@data); my $ma = $m/$a; my $na = $n/$a; if (int($ma) != $ma) { $ma = int($ma) +1; } if (int($na) != $na) { $na = int($na) +1; } $x = int($ma*$na); print $x;
#This script solves the problem of counting the amount of a*a sized block to cover the surface area of the city square, sized n*m.
When i check n = 1000000000, m = 1000000000, a = 1 i get a result x = 1e+18 instead of 1000000000000000000, despite the fact that i use int operator. could anyone help with printing the exact number?
thanks in advance, the rest cases pass ok.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Input data problem
by choroba (Cardinal) on Jan 14, 2014 at 13:33 UTC | |
|
Re^5: Input data problem
by MidLifeXis (Monsignor) on Jan 14, 2014 at 13:31 UTC |