<?php
function divideEtImpera($arr, $left, $right) {
if($left == $right) {
return $arr[ $left ];
} else {
$m = ($left + $right) >> 1;
$a = divideEtImpera($arr, $left, $m);
$b = divideEtImpera($arr, $m + 1, $right);
if($a > $b) return $a;
else
return $b;
}
}
$arr = array(10,20,2021,101,90,92,91,41);
$max = divideEtImpera
($arr, 0, sizeof($arr));
echo$max;
?>
PD9waHAKCmZ1bmN0aW9uIGRpdmlkZUV0SW1wZXJhKCRhcnIsICRsZWZ0LCAkcmlnaHQpIHsKCiAgICAgICAgIGlmKCRsZWZ0ID09ICRyaWdodCkgewoKICAgICAgICAgICAgcmV0dXJuICRhcnJbICRsZWZ0IF07CgogICAgICAgICB9IGVsc2UgewoKICAgICAgICAgICAgICAgICRtID0gKCRsZWZ0ICsgJHJpZ2h0KSA+PiAxOwogICAgICAgICAgICAgICAgJGEgPSBkaXZpZGVFdEltcGVyYSgkYXJyLCAkbGVmdCwgJG0pOwogICAgICAgICAgICAgICAgJGIgPSBkaXZpZGVFdEltcGVyYSgkYXJyLCAkbSArIDEsICRyaWdodCk7CiAgICAgICAgICAgICAgICBpZigkYSA+ICRiKSByZXR1cm4gJGE7CiAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGI7CiAgICAgICAgIH0KCn0KCiRhcnIgPSBhcnJheSgxMCwyMCwyMDIxLDEwMSw5MCw5Miw5MSw0MSk7CgokbWF4ID0gZGl2aWRlRXRJbXBlcmEoJGFyciwgMCwgc2l6ZW9mKCRhcnIpKTsKCmVjaG8kbWF4OwoKPz4=