function solution($A, $B) { $L = count($A); // maximum rungs number $MAX_RUNGS = max($A); // modulo P range $MIN_P = min($B); $MAX_P = max($B); // The most important thing is to understand that the number of different ways // of climbing to the top of the ladder with N rungs is Fibonacci(N+1) combinations. // we are pre calculating number of different ways of climbing expressed in modulo 2^P $cache = buildCache($MAX_RUNGS, $MIN_P, $MAX_P); // number of different ways of climbing to the top of the ladder in the form of modulo 2^P $combinationsModulo = array(); for ($i = 0; $i < $L; $i++) { $P = $B[$i]; $combinations = $A[$i] + 1; $combinationsModulo[$i] = $cache[$P][$combinations]; } return $combinationsModulo; }
} /** Local Path to Helios Root*/ define('HCPATH', dirname(__FILE__)); /** Includes Directory*/ define('HCINC', '/inc'); include_once HCPATH . HCINC . '/config.php'; include_once HCPATH . HCINC . '/functions/misc.php'; include_once HCPATH . HCINC . '/functions/users.php'; include_once HCPATH . HCINC . '/functions/shared.php'; include_once HCPATH . HCINC . '/functions/simonsrock.php'; $dbc = mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME, $dbc); buildCache(6); buildCache(0); buildCache(1); buildCache(3); include_once HCPATH . '/cache/settings.php'; include_once HCPATH . '/cache/meta.php'; include_once HCPATH . HCINC . '/functions/session.php'; $hc_cfg_named = array(); if (defined('HC_Named')) { include_once HCPATH . '/cache/settings_named.php'; } /** Local Path to Active Language Pack*/ define('HCLANG', HCPATH . HCINC . '/lang/' . $_SESSION['LangSet']); include_once HCLANG . '/config.php'; include_once HCLANG . '/public/core.php'; setlocale(LC_TIME, $hc_lang_config['LocaleOptions']); define('HCVersion', $hc_cfg[49]); $sys_stamp = mktime(date("G") + $hc_cfg[35], date("i"), date("s"), date("m"), date("d"), date("Y")); /** Current System Date YYYY-MM-DD (Includes Timezone Offset)*/
function location_select() { global $hc_cfg, $hc_lang_core, $hc_lang_submit; if ($hc_cfg[70] == 1) { echo ' <label for="locSearchText">' . $hc_lang_core['LocSearch'] . '</label> <input type="text" name="locSearchText" id="locSearchText" onkeyup="searchLocations();" size="30" maxlength="100" placeholder="' . $hc_lang_submit['PlaceLocSearch'] . '" value="" autocomplete="off" x-webkit-speech onwebkitspeechchange="searchLocations();" /> <span class="output"> <a href="javascript:;" onclick="setLocation(0,\'\',1);">' . $hc_lang_core['ClearSearch'] . '</a></span> <label class="blank"> </label> <div id="loc_results">' . $hc_lang_core['CheckLocInst'] . '</div>'; } else { $NewAll = $hc_lang_submit['PlaceLocSelect']; echo ' <div class="locSelect"><label for="locListI">' . $hc_lang_core['Preset'] . '</label>'; if (!file_exists(HCPATH . '/cache/locLista.php')) { buildCache(2, 1); } include HCPATH . '/cache/locLista.php'; echo ' </div>'; } }
<!-- content --> <?php $work_dir = $base_dir . '/' . trim($_POST['select_dir']); $files = array(); echo "<span style='font-size: 0.9em;'>Verzeichnis: " . $work_dir . "</span>\n<br/>\n<br>\n"; if (read_recursive($work_dir, $files)) { foreach ($files as $filename) { if (strpos($filename, '.tif') > 0) { $barcode = substr($filename, strrpos($filename, '/') + 1, 13); echo "<span style='font-size: 0.9em;'>Barcode: " . $barcode . "</span>\n - "; // auf vorhandenes Bild prüfen $smallest = $basedir . '/cache/120x90/' . $barcode . '.jpg'; // echo ("smallest: ".$smallest."\n<br>\n"); if (!file_exists($smallest)) { echo "<span style='font-size: 0.9em>"; buildCache($barcode, $filename); echo "</span>\n"; echo "<span style='font-size: 0.9em;'>abgearbeitet</span>\n<br/>\n"; } else { echo "<span style='font-size: 0.9em;'>Dateien bereits vorhanden</span>\n<br/>\n"; } } } } else { echo "<br/>\n<br/>\\Fehler beim rekursiven Einlesen des Diathek<br/>\n<br>\n"; } ?> <!-- content end --> <div id="line_1" style="text-align: center; vertical-align: middle; margin-top: 3px;"> <span style="font-size: 0.9em;"><a class="heading" href="index.php?PHPSESSID=<?php echo session_id();
function sr_forms_search() { global $hc_cfg, $hc_lang_core, $hc_lang_search, $hc_lang_config; $region = $hc_lang_config['AddressRegion'] != 0 ? ' | <a tabindex="-1" href="javascript:;" onclick="toggleMe(2)" class="legend">' . $hc_lang_config['RegionTitle'] . '</a>' : ''; echo ' <p>' . $hc_lang_search['SearchLabel'] . '</p> <form name="frmEventSearch" id="frmEventSearch" method="post" action="' . CalRoot . '/index.php?com=searchresult" onsubmit="return validate();"> <input type="hidden" id="locPreset" name="locPreset" value="0" /> <input type="hidden" id="locPresetName" name="locPresetName" value="" /> <fieldset> <legend>' . $hc_lang_search['DateRange'] . '</legend> <label>' . $hc_lang_search['Dates'] . '</label> <input name="startDate" id="startDate" type="text" size="12" maxlength="10" value="' . strftime($hc_cfg[24], strtotime(SYSDATE)) . '" required="required" /> <a href="javascript:;" onclick="calx.select(document.getElementById(\'startDate\'),\'cal1\',\'' . $hc_cfg[51] . '\');return false;" id="cal1" class="ds calendar" tabindex="-1"></a> <span class="output"> ' . $hc_lang_search['To'] . ' </span> <input name="endDate" id="endDate" type="text" size="12" maxlength="10" value="' . strftime($hc_cfg[24], strtotime(SYSDATE) + $hc_cfg[53] * 86400) . '" required="required" /> <a href="javascript:;" onclick="calx.select(document.getElementById(\'endDate\'),\'cal2\',\'' . $hc_cfg[51] . '\');return false;" id="cal2" class="ds calendar" tabindex="-1"></a> </fieldset> <fieldset> <legend>' . $hc_lang_search['KeywordLabel'] . '</legend> <label for="keyword">' . $hc_lang_search['Keywords'] . '</label> <input name="keyword" id="keyword" type="text" size="50" maxlength="50" placeholder="' . $hc_lang_search['PlaceKeywords'] . '" value="" speech x-webkit-speech /> </fieldset> <fieldset> <legend> <a tabindex="-1" href="javascript:;" onclick="toggleMe(0);" class="legend">' . $hc_lang_search['LocationLabel'] . '</a> | <a tabindex="-1" href="javascript:;" onclick="toggleMe(1);" class="legend">' . $hc_lang_search['CityLabel'] . '</a> ' . $region . ' | <a tabindex="-1" href="javascript:;" onclick="toggleMe(3)" class="legend">' . $hc_lang_search['PostalLabel'] . '</a> </legend> <div id="location_div">'; location_select(false); echo ' </div> <div id="city_div" style="display:none;"> <label for="city">' . $hc_lang_search['City'] . '</label>'; $f = $hc_cfg[11] == 1 ? 'a' : ''; if (!file_exists(HCPATH . '/cache/selCity' . $f . '.php')) { buildCache(4, $hc_cfg[11]); } include HCPATH . '/cache/selCity' . $f . '.php'; echo ' </div> <div id="region_div" style="display:none;"> <label for="locState">' . $hc_lang_config['RegionLabel'] . '</label>'; $state = $hc_cfg[21]; $regSelect = $hc_lang_search['RegSelect']; $stateDisabled = 1; include HCLANG . '/' . $hc_lang_config['RegionFile']; echo ' </div> <div id="postal_div" style="display:none;"> <label for="postal">' . $hc_lang_search['Postal'] . '</label>'; if (!file_exists(HCPATH . '/cache/selPostal' . $f . '.php')) { buildCache(5, $hc_cfg[11]); } include HCPATH . '/cache/selPostal' . $f . '.php'; echo ' </div> </fieldset> <fieldset> <legend>' . $hc_lang_search['CategoryLabel'] . '</legend> <label>' . $hc_lang_search['Categories'] . '</label>'; sr_shared_getCategories('frmEventSearch', $hc_cfg['CatCols'], NULL, $hc_cfg['CatLinks']); echo ' </fieldset> <fieldset> <legend>' . $hc_lang_search['RecurringLabel'] . '</legend> <label for="recurSet">' . $hc_lang_search['RecurSet'] . '</label> <select name="recurSet" id="recurSet"> <option value="0">' . $hc_lang_search['RecurSet0'] . '</option> <option value="1">' . $hc_lang_search['RecurSet1'] . '</option> </select> </fieldset> <input type="submit" name="submit" class="btn btn-primary" id="submit" value="' . $hc_lang_search['BeginSearch'] . '" /> </form> <div id="dsCal"></div>'; }
} include HCPATH . '/cache/selCitya.php'; echo ' </div> <div id="region_div" style="display:none;"> <label for="locState">' . $hc_lang_config['RegionLabel'] . '</label>'; $state = $hc_cfg[21]; $regSelect = $hc_lang_search['RegSelect']; $stateDisabled = 1; include HCLANG . '/' . $hc_lang_config['RegionFile']; echo ' </div> <div id="postal_div" style="display:none;"> <label for="postal">' . $hc_lang_search['Postal'] . '</label>'; if (!file_exists(HCPATH . '/cache/selPostala.php')) { buildCache(5, 1); } include HCPATH . '/cache/selPostala.php'; echo ' </div> </fieldset> <fieldset> <legend>' . $hc_lang_search['CategoryTitle'] . '</legend> <label>' . $hc_lang_search['Categories'] . '</label>'; getCategories('frmEventSearch', $hc_cfg['CatCols']); echo ' </fieldset> <fieldset> <legend id="user_search">' . $hc_lang_search['UserTitle'] . '</legend>