- 1
- 2
- 3
while(SLOBirthsISEX->Strings[p].Length() < 1){
SLOBirthsISEX->Strings[p] = " " + SLOBirthsISEX->Strings[p];
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+134
while(SLOBirthsISEX->Strings[p].Length() < 1){
SLOBirthsISEX->Strings[p] = " " + SLOBirthsISEX->Strings[p];
}
нет слов
+134
foreach (Admin _admin in _admins.Where(a => a.Login == _login))
{
if (_admin.Password == _password)
{
SessionObj = new Al2AllAuth
{
AccessId = _admin.Type,
Ename = _admin.Name,
Whoid = _admin.Id
};
var _type = (AdminTypes) _admin.Type;
switch (_type)
{
case AdminTypes.FirstType:
return RedirectToAction(c_adminActionName, c_userControllerName);
case AdminTypes.SecondType:
if (string.IsNullOrEmpty(model.Page) || string.IsNullOrEmpty(model.Uid))
throw new ArgumentException(InternalResources.EmptyPageOrUid, "model");
return RedirectToAction(model.Page, new { uid = model.Uid });
default:
break;
}
}
else
{
return RedirectToAction(_errorActionName);
}
}
Лямбда в foreach очен смутила... Зачем?
+134
ok = r.nextInt(prob) <= prob
рассчитываем вероятность события...
+134
/* A C statement or statements which output an assembler instruction
opcode to the stdio stream STREAM. The macro-operand PTR is a
variable of type `char *' which points to the opcode name in its
"internal" form--the form that is written in the machine description.
GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
So use `repe' instead. */
#undef ASM_OUTPUT_OPCODE
#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
{ \
if ((PTR)[0] == 'r' \
&& (PTR)[1] == 'e' \
&& (PTR)[2] == 'p') \
{ \
if ((PTR)[3] == 'z') \
{ \
fputs ("repe", (STREAM)); \
(PTR) += 4; \
} \
else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
{ \
fputs ("repne", (STREAM)); \
(PTR) += 5; \
} \
} \
else \
ASM_OUTPUT_AVX_PREFIX ((STREAM), (PTR)); \
}
Костыль из GCC. Ассемблер GAS версии 1.38.1 не переваривает мнемоники repz и repnz. Эта макрохрень перекодирует их в repe и repne соответственно
https://github.com/mirrors/gcc/blob/master/gcc/config/i386/gas.h#L81
+134
#include <stdio.h>
#define max(x,y) ((x>y)?x:y)
#define N 255
typedef unsigned char uchar;
uchar s,t,x,y,z,n,S[10000],FO[N+N*(N-1)/2];
uchar mask[]={1,2,4,8,16,32,64,128};
int TOP=0;
unsigned int COUNTER=0,AO[N];
FILE *in;
int pop(){
//if the top element in the stack is passed and stack is not empty,
//find next parent vertex
while(S[TOP]>128 && TOP>0) TOP-=S[TOP]-128;
return(TOP);
}
int push(){ //add new elements to the stack
int tmp=TOP,i,j,k; //tmp is a temporary variable
x=S[TOP-S[TOP]+1]; //x is a parent vertex
for(i=1;i<=FO[AO[x]];i++){
y=FO[AO[x]+i]; //y is a neigbour of x
if(!test(y)){ //y is visited? if not keep going
k=max(y/8+1,S[TOP]-2); //copy set P(x) to the new set P(y)
S[++tmp]=y;
for(j=0;j<k;j++,S[++tmp]=0);
S[++tmp]=k+2;
for(j=1;j<=S[TOP]-2;j++) S[tmp-j]=S[TOP-j];
S[tmp-(y/8+1)]|=mask[y-(y/8)*8]; //add child y to P(y)
}
}
S[TOP]+=128; //drop flag for the vertex x
TOP=tmp; //the last child y become parent
}
int test(int j){ //does vertex j in the set P(TOP)?
z=((j/8+1)>S[TOP]-2)?0:(S[TOP-(j/8+1)] & mask[j-(j/8)*8])?1:0;
return(z);
}
int inc(){ //the path was found
COUNTER++;
S[TOP]+=128;
}
int main(){
int i,j,k;
in=fopen("Data15.txt","r"); //open file
fscanf(in," %d %d",&i,&n); //read the number of vertices
for(k=n,i=0;k>=0;k--){
fscanf(in,"%d %d",&j,&FO[i]);
j=FO[i];
for(AO[n-k]=++i-1;j>0;j--,i++){
fscanf(in,"%d ",&FO[i]);
}
}
printf("Type first and end nodes: "); //type s and t separated by space
scanf("%d %d",&s,&t);
S[0]=s;
for(j=1;j<=s/8+1;S[j++]=0);
S[j]=s/8+3;
TOP=j;
S[TOP-(s/8+1)]|=mask[s-(s/8)*8];
while(pop()>=0) (test(s) && test(t))?inc():push(); //launch breadth-search algorithm
printf("# of paths in the graph b/w s=%d and t=%d equals %d\n",s,t,COUNTER);
return(0);
}
разбирая старый CD бэкап откопал лабу...(знаю,знаю что продакшн кошернее, и на сях не пишу со студенчества)
хотел вайпнуть безжалости но вспомнил про говнокодосайт.
помоему код люто доставляет.
прога подсчитывает полное число путей в графе между заданными вершинами s и t.
граф считывается из файла в формате: "номер_вершины степень_вершины {достижимые_вершины_через_пробел}"
(по коду видно)
+134
http://www.freepascal.ru/forum/viewtopic.php?t=9463&p=77107
ебаный пиздец.
ебаный пиздец.
+134
load 'regex'
f=: 13 : '((+./-.(1 2 3 4{y))+.(0{y))*.(5{y)'
a =: #:i.2^6
b =: f"(1) a
cc =: ":|:(|:a),(|:b)
cc1 =: (32+i.32){cc
cc2 =: (i.32){cc
ccc=:|:(|:cc2),(1 32$'*'),(|:cc1)
ccc=:('\*';'&&') rxrplc"1 (ccc)
(,&'\\ \hline')"1 (' ';' & ')rxrplc"1 (ccc)
Вот он, первый говнокод на J
+134
Random random = new Random(Environment.TickCount);
for (int i = 0; i < random.Next(380, 480); i++)
{
Marshal.AllocHGlobal(random.Next(0x4400, 0xd400));
Thread.Sleep(1);
}
Из исходников подрядчика...
Заказчиков надо садить на иглу правильно
+134
public bool SqlTest(string sql)
{
try
{
if (Utils.ExecuteScalar(sql).ToString() != "8") throw new Exception("Bad result from DB!");
}
catch (Exception ex)
{
LogService.WriteStd("CheckDBRun1: " + sql, ex);
Utils.SQLServerRun();
try
{
if (Utils.ExecuteScalar(sql).ToString() != "8") throw new Exception("Bad result from DB!");
}
catch (Exception ex2)
{
LogService.WriteStd("CheckDBRun2: " + sql, ex2);
return false;
}
}
return true;
}
+134
int t, max, x;
scanf("%d", &x);
for(t=x%10; max!=t; max=t);
for(t=x%100/10; max<t; max=t);
for(t=x%1000/100; max<t; max=t);
for(t=x/1000; max<t; max=t);
printf("Max: %d\n", max);
Нахождение максимальной цифры в 4-значном числе. Одна из первых лаб по Си. Предполагалось использование if, но студенты не ищут лёгких путей. (Сдвиги они пока не учили, так что на вычисление цифры не обращайте внимания.)