- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
double a = 47, b = 94;
for (;; a += .5, b -= .5) {
if (a == b) {
System.out.println(a);
break;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 2
+86
double a = 47, b = 94;
for (;; a += .5, b -= .5) {
if (a == b) {
System.out.println(a);
break;
}
}
...ищем среднее.. (a+b)/2 категорически нельзя..
+175.2
$arr = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
$result = $mysql->query("SELECT `upload` FROM `images` WHERE `upload` > '".(time()-60*60*24)."' AND `deleted` = '0' ORDER BY `upload` ASC");
while($row = mysql_fetch_array($result))
{
switch($row['upload'])
{
case (($row['upload'] > (time()-60*60*24)) && ((time()-60*60*23) > $row['upload'])):
$arr['23']++;
break;
case (($row['upload'] > (time()-60*60*23)) && ((time()-60*60*22) > $row['upload'])):
$arr['22']++;
break;
case (($row['upload'] > (time()-60*60*22)) && ((time()-60*60*21) > $row['upload'])):
$arr['21']++;
break;
case (($row['upload'] > (time()-60*60*21)) && ((time()-60*60*20) > $row['upload'])):
$arr['20']++;
break;
case (($row['upload'] > (time()-60*60*20)) && ((time()-60*60*19) > $row['upload'])):
$arr['19']++;
break;
case (($row['upload'] > (time()-60*60*19)) && ((time()-60*60*18) > $row['upload'])):
$arr['18']++;
break;
case (($row['upload'] > (time()-60*60*18)) && ((time()-60*60*17) > $row['upload'])):
$arr['17']++;
break;
case (($row['upload'] > (time()-60*60*17)) && ((time()-60*60*16) > $row['upload'])):
$arr['16']++;
break;
case (($row['upload'] > (time()-60*60*16)) && ((time()-60*60*15) > $row['upload'])):
$arr['15']++;
break;
case (($row['upload'] > (time()-60*60*15)) && ((time()-60*60*14) > $row['upload'])):
$arr['14']++;
break;
case (($row['upload'] > (time()-60*60*14)) && ((time()-60*60*13) > $row['upload'])):
$arr['13']++;
break;
case (($row['upload'] > (time()-60*60*13)) && ((time()-60*60*12) > $row['upload'])):
$arr['12']++;
break;
case (($row['upload'] > (time()-60*60*12)) && ((time()-60*60*11) > $row['upload'])):
$arr['11']++;
break;
case (($row['upload'] > (time()-60*60*11)) && ((time()-60*60*10) > $row['upload'])):
$arr['10']++;
break;
case (($row['upload'] > (time()-60*60*10)) && ((time()-60*60*9) > $row['upload'])):
$arr['9']++;
break;
case (($row['upload'] > (time()-60*60*9)) && ((time()-60*60*8) > $row['upload'])):
$arr['8']++;
break;
case (($row['upload'] > (time()-60*60*8)) && ((time()-60*60*7) > $row['upload'])):
$arr['7']++;
break;
case (($row['upload'] > (time()-60*60*7)) && ((time()-60*60*6) > $row['upload'])):
$arr['6']++;
break;
case (($row['upload'] > (time()-60*60*6)) && ((time()-60*60*5) > $row['upload'])):
$arr['5']++;
break;
case (($row['upload'] > (time()-60*60*5)) && ((time()-60*60*4) > $row['upload'])):
$arr['4']++;
break;
case (($row['upload'] > (time()-60*60*4)) && ((time()-60*60*3) > $row['upload'])):
$arr['3']++;
break;
case (($row['upload'] > (time()-60*60*3)) && ((time()-60*60*2) > $row['upload'])):
$arr['2']++;
break;
case (($row['upload'] > (time()-60*60*2)) && ((time()-60*60*1) > $row['upload'])):
$arr['1']++;
break;
case ($row['upload'] > (time()-60*60*1)):
$arr['0']++;
break;
}
}
график :)