<?php
header('Content-type: text/html; charset=utf-8'); $digits = array(11, 10, 16, 7, 14, 17, 12, 13); $size = count($digits) - 1; for ($i = 0; $i <= $size; $i++) {
perm($i, $digits, $newDigits);
}
function perm($k, &$array, &$newArray)
{
for ($q = 0; $q+$k < count($array); $q++) { $newArray[$k + $q] = $array[$k + $q];
if ($k < (count($array) - 1)) { perm($k + $q + 1, $array, $newArray);
}
checkArray($newArray, $array);
unset($newArray[$k + $q]); }
}
function checkArray (&$array, &$arrayOld)
{
foreach ($arrayOld as $index => $element) {
if (!(isset($array[$index]))) { $newArray[] = $element;
}
}
echo $s . "\n";
}
echo $s." = 100. \n";
}
}
PD9waHAKICAgIGhlYWRlcignQ29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgnKTsKICAgICRkaWdpdHMgPSBhcnJheSgxMSwgMTAsIDE2LCA3LCAxNCwgMTcsIDEyLCAxMyk7CiAgICAkc2l6ZSA9IGNvdW50KCRkaWdpdHMpIC0gMTsKICAgICRzdW0gPSBhcnJheV9zdW0oJGRpZ2l0cyk7CiAgICAkbmV3RGlnaXRzID0gYXJyYXkoKTsKICAgIGZvciAoJGkgPSAwOyAkaSA8PSAkc2l6ZTsgJGkrKykgewogICAgICAgIHBlcm0oJGksICRkaWdpdHMsICRuZXdEaWdpdHMpOwogICAgfQogICAgZnVuY3Rpb24gcGVybSgkaywgJiRhcnJheSwgJiRuZXdBcnJheSkgCiAgICB7CiAgICAgICAgZm9yICgkcSA9IDA7ICRxKyRrIDwgY291bnQoJGFycmF5KTsgJHErKykgewogICAgICAgICAgICAkbmV3QXJyYXlbJGsgKyAkcV0gPSAkYXJyYXlbJGsgKyAkcV07CiAgICAgICAgICAgIGlmICgkayA8IChjb3VudCgkYXJyYXkpIC0gMSkpIHsKICAgICAgICAgICAgICAgIHBlcm0oJGsgKyAkcSArIDEsICRhcnJheSwgJG5ld0FycmF5KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjaGVja0FycmF5KCRuZXdBcnJheSwgJGFycmF5KTsKICAgICAgICAgICAgdW5zZXQoJG5ld0FycmF5WyRrICsgJHFdKTsKICAgICAgICAgICAgfQogICAgfQogICAgZnVuY3Rpb24gY2hlY2tBcnJheSAoJiRhcnJheSwgJiRhcnJheU9sZCkgCiAgICB7CiAgICAgICAgaWYgKGFycmF5X3N1bSgkYXJyYXkpICogMiA9PSBhcnJheV9zdW0oJGFycmF5T2xkKSkgewogICAgICAgICAgICAkbmV3QXJyYXkgPSBhcnJheSgpOwogICAgICAgICAgICBmb3JlYWNoICgkYXJyYXlPbGQgYXMgJGluZGV4ID0+ICRlbGVtZW50KSB7CiAgICAgICAgICAgICAgICBpZiAoIShpc3NldCgkYXJyYXlbJGluZGV4XSkpKSB7CiAgICAgICAgICAgICAgICAgICAgJG5ld0FycmF5W10gPSAkZWxlbWVudDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICAkcyA9IGltcGxvZGUoIiArICIsICRhcnJheSkgLiAiID0gIiAuIGltcGxvZGUoIiArICIsICRuZXdBcnJheSk7CiAgICAgICAgICAgIGVjaG8gJHMgLiAiXG4iOwogICAgICAgICAgICB9CiAgICAgICAgaWYgKGFycmF5X3N1bSgkYXJyYXkpID09IDEwMCkgewogICAgICAgICAgICAkcyA9IGltcGxvZGUoIiArICIsICRhcnJheSk7CiAgICAgICAgICAgIGVjaG8gJHMuIiA9IDEwMC4gXG4iOwogICAgICAgIH0KICAgIH0=