- 1
if (indSpec == false || indZone == false || (FRof != null && FRof == 2)) result = 1;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+93
if (indSpec == false || indZone == false || (FRof != null && FRof == 2)) result = 1;
Нашли в проекте вот такое "женское" условие. Видимо, префиксом "ind" автор намекала на своё происхождение.
+128
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>По колено в коде — Говнокод.ру</title>
<!-- Пару десятков строчек спустя -->
<li><script type="text/javascript" src="http://reformal.ru/tab.js?title=%C3%EE%E2%ED%EE%EA%EE%E4.%F0%F3%3A+%EF%EE+%EA%EE%EB%E5%ED%EE+%E2+%EA%EE%E4%E5&domain=govnokod&color=adadad&align=left&charset=cp1251&ltitle=%CE%F2%E7%FB%E2%FB&lfont=Verdana, Geneva, sans-serif&lsize=11px&waction=0&regime=1"></script></li>
Чтобы решить проблему с кодировкой - нужно просто поменять charset=cp1251 на charset=utf8, вестимо.
Но страйко который год не может.
+8
#include <stdio.h>
#include <string>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
char s[100];
int n1 = 0,eq = 0,i = 0,o = 0,e = 0;
scanf("%s",&s);
int len;
len = strlen(s);
for(i = 0; i <= len; i++)
{
if ((s[i] == '+') || (s[i] == '-') || (s[i] == '/') || (s[i] == '*'))
{
if (s[i-1] != '=')
{
n1 = i;
o = 1;
}
if ((n1 == '-') && (s[i-1] == '+') || (s[i-1] == '-') || (s[i-1] == '/') || (s[i-1] == '*'))
{
n1--;
o = 1;
}
}
if (s[i] == '=')
{
eq = i;
e++;
}
}
if ((eq == 0) || (n1 == 0) || (e != 1) || (o != 1))
{
printf("ERROR");
return 0;
}
char* err ;
//begin copy-paste :(
char s1[100] = "0";
for(i = 0; i < n1; i++)
{
s1[i] = s[i];
}
long l1 = strtol(s1, &err, 10);
if (*err)
{
printf("ERROR");
return 0;
}
//еще 10-15 строк
//end copy-paste :(
//begin new copy-paste :((
if (s[n1] == '+')
{
if (l1 + l2 == l3)
{
printf("YES");
} else
{
printf("NO");
}
}
if (s[n1] == '/')
{
if (l2 != 0)
{
if((l1 / l2 == l3) && (l1 % l2 == 0))
{
printf("YES");
} else
{
printf("NO");
}
} else
{
printf("NO");
}
}
//Еще 10-15 строк
//end new copy-paste :((
return 0;
}
А всего-то надо проверить верно ли тождество. (Тождество очень простое и состоит из числа, операции («+», «-», «*», «/»), числа, знака равенства и числа)
+121
minChunksSize=1000.0 -- 100.0
facbig :: Integer -> Integer
facbig n =
let
divisionProportion = 0.9 -- 2.0/3.0
amountOfChunk = truncate $ logBase divisionProportion $ minChunksSize/fromIntegral n
proportions = map (divisionProportion^) [amountOfChunk, amountOfChunk-1 .. 1]
centralChunkResults = map product [
let
begin = proportionToItemNumber 1 beginRangeProportion
end = proportionToItemNumber 0 endRangeProportion
in
[begin..end] | (endRangeProportion, beginRangeProportion) <- zip proportions $ tail proportions ]
beginChunkResult = product [1 .. proportionToItemNumber 0 $ last proportions]
endChunkResult = product [proportionToItemNumber 1 $ head proportions .. n]
in product $ beginChunkResult:endChunkResult:centralChunkResults
where
proportionToItemNumber shift proportion =
shift + truncate ((1.0-proportion)*fromIntegral n)
fac n = if n <= (truncate $ 3.0*minChunksSize)
then product [1..n]
else facbig n
main = print $ length $ show $ fac 100000
Вот так вот школота считают число цифр в факториале числа.
+70
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/compare.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/compare.tpl';
} else {
$this->template = 'default/template/product/compare.tpl';
}
Спешите видеть в конце каждого контроллера OpenCart. Ох уж это MVC ради MVC...
+75
require( "./configuration.php" );
include( "./include.php" );
$returned = @( );
if ( ( $returned ) != @( "harper" ) )
+86
int createStageCycles = 0;
createStageCycles = Integer.parseInt(strCycle);
int nextVal = new Integer(createStageCycles) + 1;
int двойного отжима
−428
url = request.get_full_path()
if 'show_error' in url:
show_param = url.split('?show_error=')
error = show_param[1]
Кусок кода из Django проекта
Взяли индуса на работу. Вот так он достает GET параметры
+111
{$APPTYPE CONSOLE}
{$R *.res}
type
TFTest = class
public
B: string;
function Add(S: string = ''): TFTest;
constructor Create(T: TFTest); overload;
end;
function TFTest.Add(S: string): TFTest;
begin
B := B + S;
Exit(Self);
end;
var
A: TFTest;
constructor TFTest.Create(T: TFTest);
begin
B := T.B;
end;
begin
writeln(TFTest.Create.Add('0')
.Create((TFTest.Create(TFTest.Create(((((((TFTest.Create(TFTest.Create).Add('0')).Add('1').Create.Add('2')
.Add as TObject).Create) as TFTest.ClassParent) as TFTest).Create).Add('3')).Add.Add('4').Create).Add('5')).Add('6')
).Add('7').B);
readln;
end.
Кто правильно обьяснит этот код, получит... ничего получит :)
+115
foreach (var sheet in paper.Decomposed)
{
if (ct > 0 && sheet.Equals(paper.Decomposed[ct]))
{
paper.PaperPrice += paperPrice;
paper.PrintingPrice += printingPrice;
paper.PlatesPrice += platesPrice;
ct++;
continue;
}
ct++;
...
}