Answer the question
In order to leave comments, you need to log in
Can anyone explain what this part of the code does?
sub two {
my @first;
my @second;
my $f0 = $_[0];
my $s0 = $_[1];
my $aline = $_[2];
my $gline = $_[3];
my ($i,$j,$prob);
my ($wo, $w, $wu, $do, $d, $du, $lo, $l, $lu);
$wo = $w = $wu = $do = $d = $du = $lo = $l = $lu = 0;
$first[0] = exp(-$f0);
$second[0] = exp(-$s0);
for ($i = 1; $i < 20; $i++) {
$first[$i] = $first[$i-1]*$f0/$i;
$second[$i] = $second[$i-1]*$s0/$i;
}
for ($i = 0; $i < 20; $i++) {
for ($j = 0; $j < 20; $j++) {
$prob = $first[$i]*$second[$j];
if ($i + $aline > $j) {
if ($i+$j > $gline) {
$wo += $prob;
} elsif ($i+$j < $gline) {
$wu += $prob;
} else { $w += $prob;}
} elsif ($i + $aline < $j) {
if ($i+$j > $gline) {
$lo += $prob;
} elsif ($i+$j < $gline) {
$lu += $prob;
} else { $l += $prob;}
} else {
if ($i+$j > $gline) {
$do += $prob;
} elsif ($i+$j < $gline) {
$du += $prob;
} else { $d += $prob;}
}
}
}
return ($wo, $w, $wu, $do, $d, $du, $lo, $l, $lu);
}
Answer the question
In order to leave comments, you need to log in
It's not the complexity of the code, it's just mathematical calculations, some order of numbers is calculated.
$first[$i] = $first[$i-1]*$f0/$i;
The input is four parameters, returns an array of data.
Sroll you do not diva and window;
For scrolling to occur in a div, its height must be less than the height of its content
codepen.io/anon/pen/VKzRPa
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question