俄罗斯乘法 无 ?phpfunction russian($m, $n, $res = 0){(1 == ($n 1)) $res += $m;$m = $m 1;$n = $n 1;return $n ? russian($m, $n, $res) : $res;}echo russian(7, 8);
俄罗斯乘法
<?php function russian($m, $n, $res = 0){ (1 == ($n & 1)) && $res += $m; $m = $m << 1; $n = $n >> 1; return $n ? russian($m, $n, $res) : $res; } echo russian(7, 8);