You are viewing a single comment's thread. Return to all comments →
Perl:
sub getMoneySpent { my ($keyboard, $drives, $b) = @_; my $most_expensive = 0; my $keyb = 0; my $device = 0; for (my $i = 0; $i < scalar(@$keyboard); $i++) { for (my $j = 0; $j < scalar(@$drives); $j++) { if ($keyboard->[$i] < $b || $drives->[$j] < $b) { my $sum = $keyboard->[$i] + $drives->[$j]; if ($sum > $most_expensive && $sum <= $b) { $most_expensive = $sum; $keyb = $keyboard->[$i]; $device = $drives->[$j]; } } } } return (($keyb + $device) > 0) ? $keyb + $device : -1; }
Seems like cookies are disabled on this browser, please enable them to open this website
Electronics Shop
You are viewing a single comment's thread. Return to all comments →
Perl: