Jump to content

crashmaster

Members
  • Posts

    169
  • Joined

  • Last visited

    Never

About crashmaster

  • Birthday 12/13/1987

Contact Methods

  • Website URL
    http://www.dnbstep.cz
  • ICQ
    308700731

Profile Information

  • Gender
    Male
  • Location
    Czech Republic, Prague

crashmaster's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks, you helped me ))) Yes, your function is pretty simple )) Thanks a lot))
  2. What do you think about this fn ?? $a[0] = -7; $a[1] = 5; $a[2] = 1; $a[3] = 2; $a[4] = -4; $a[5] = 3; $a[6] = 0; //Dumping input array echo '<pre>'; print_r($a); echo '</pre><hr>'; function equi($a,$index=0) { //<______________ARRAY OF NUMBERS_______________>/// //<-------R--<==== |EQ index| =====>----R------>/// //<---|lower_ind|---|EQ index|---|higher_ind|--->/// $lower_indexes = $higher_indexes = intval(0); //SUM OF INDEXES $lower_values = $higher_values = array(); //ELEMENTS OF (HIGHER|LOWER) INDEXES SUM foreach ($a as $k=>$v) { //Counting SUM of |lower_ind| if ($k < $index) { $lower_indexes = $lower_indexes + $v; $lower_values[] = 'A['.$k.']'; } //Counting SUM of |higher_ind| if ($k > $index) { $higher_indexes = $higher_indexes + $v; $higher_values[] = 'A['.$k.']'; } } echo 'SEARCHING INDEX IS: <strong>'.$index.'</strong><br>'; echo 'SUM OF <strong>LOWER</strong> INDEXES ('.implode(' + ',$lower_values).') IS: '.$lower_indexes.'<br>'; echo 'SUM OF <strong>HIGHER</strong> INDEXES ('.implode(' + ',$higher_values).') IS: '.$higher_indexes.'<br>'; //Searching EQ index if ($lower_indexes == $higher_indexes) { echo '<font color="red"><strong><u>EQUILIBRIUM INDEX IS: '.$index.'</u></strong></font>.'; } else { echo 'Not found.'; } //How many times are allowed to run program in cycle (till end of array indexes) $steps = (count($a) - 1); if ($index < $steps) { echo ' Searching again with new index <b>'.($index + 1).'</b>...<br>-----------------------------------------<br>'; $index++; equi($a,$index); } else { echo '<hr>Program STOP...'; } } //Run equi($a);
  3. Hi there, i have a task, to write function in php. Who can help me? There is a task: Equilibrium (EQ) Index of a sequence (array) is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in array A: Array: A[0] = -7 A[1] = 1 A[2] = 5 A[3] = 2 A[4] = -4 A[5] = 3 A[6] = 0 3 is an EQ index, beacuse: A[0] + A[1] + A[2] = A[4] + A[5] + A[6] 6 is also EQ index, coz: A[0] + A[1] + A[2] + A[3] + A[4] + A[5] = 0 (sum of zero elements is zero) 7 is not an EQ index, because it is not a valid index of array A Assume the sum of zero elements is equal zero. Write a function.
  4. Hi there, I am quite new in CSS, and need help from prof. I was wondered by nice, good looking drop down menus. There are lot of stuff in internet about it... But now I have a job, and should make DROP UP menu. I dont know how to style it only in CSS, so I also used JS. You can see it here (http://fmark.dnbstep.cz). Everything looks good, but in IE - menu is blinking. I dont know how to fix it... Do you have any idea ?? P.S. If you have a better (more simple) solution, than mine (CSS [positioning by moving element by >position: absolute; top:10...etc<] + JavaScript [jquery]), post it. I will be very grateful ;-) Thanks a lot, cya
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.