1. Куча / Говнокод #11459

    +129

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    F[numbers_, setNumber_, ParenNum_] := 
     Block[{func = {"+", "-", "*", "/"}[[setNumber]], 
       parens = {{"", "", "", "", "", ""}, {"", "(", "", "", ")", 
           ""}, {"", "", "", "(", "", ")"}, {"", "(", "", "", "", 
           ")"}, {"(", "", ")", "(", "", ")"}}[[ParenNum]], e}, 
      e = ToExpression[
        ToString[
         StringJoin[parens[[1]], ToString[numbers[[1]]], func[[1]], 
          parens[[2]], ToString[numbers[[2]]], parens[[3]], func[[2]], 
          parens[[4]], ToString[numbers[[3]]], parens[[5]], func[[3]], 
          ToString[numbers[[4]]], parens[[6]]]]]; e];Timing[c = 0; d = 0; 
     b = Permutations[{1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4}, {3}]; 
     For[n1 = 1, n1 < 10, n1++, 
      For[n2 = 1, n2 < n1, n2++, 
       For[n3 = 1, n3 < n2, n3++, 
        For[n4 = 1, n4 < n3, n4++, 
         a = Permutations[{n1, n2, n3, n4}, {4}]; sol = {}; 
         For[i = 1, i <= Length[a], i++, 
          For[j = 1, j <= 64, j++, 
           For[n = 1, n <= 5, n++, g = F[a[[i]], b[[j]], n]; 
            If[IntegerQ[g] && g > 0, AppendTo[sol, g]]]]; 
          m = Sort[DeleteDuplicates[sol]]; 
          l = Complement[Range[1000], m][[1]]; 
          If[l > c, c = l; d = {n1, n2, n3, n4}]]]]]]; 
     FromDigits[Reverse[d]]]

    http://projecteuler.net/problem=93
    http://projecteuler.net/thread=93&page=6


    Язык, кстати, Mathematica.

    TheHamstertamer, 22 Июля 2012

    Комментарии (7)
  2. C++ / Говнокод #11458

    +23

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    const Tifon& Tifon::operator=(const Tifon& Buffer)
    {
            assert(&Buffer!=this);
            if(&Buffer==this)
                    return *this;
            Tifon OldForExceptionSafe(*this);
            try{
                    this->~Tifon();
                    ::new((void*)this)Tifon(Buffer);
            }catch(...){//try restore
                    ::new((void*)this)Tifon(OldForExceptionSafe);
            }
            return *this;
    };
     //...
    namespace std
    {
            const Tifon&swap (Tifon& a, Tifon& b) {
            assert(&a!=&b);
            if(&a==&b)
                    return a;
            Tifon c(a);
            a=b;
            b=c;
            }
    };

    USB, 22 Июля 2012

    Комментарии (88)
  3. C++ / Говнокод #11457

    +7

    1. 1
    2. 2
    QRegion* region = new QRegion(*(new QRect(button->x()+5,button->y()+5,190,190)),QRegion::Ellipse);
    button->setMask(*region);

    panter_dsd, 22 Июля 2012

    Комментарии (38)
  4. Куча / Говнокод #11456

    +128

    1. 1
    2. 2
    3. 3
    func fff() func() func() func() string {
    	return func() func() func() string { return func() func() string { return func() string { return "DON'T DO THAT!" } } }
    }

    http://play.golang.org/p/KN4E1RotKl

    USB, 22 Июля 2012

    Комментарии (36)
  5. C++ / Говнокод #11455

    +3

    1. 1
    x*x = new x;

    Уравнение?

    USB, 21 Июля 2012

    Комментарии (44)
  6. ActionScript / Говнокод #11454

    −114

    1. 1
    2. 2
    3. 3
    this.editable = true;
    this.itemEditor = new ClassFactory(UIDEditor);
    this.disableInEdit = true;

    Чудесное сочетание значений при котором мы не можем редактировать запись но при этом видеть в окошке редактирования...
    Это только два месяца разработки, интересно, костыли какой кудрявости я увижу через год?

    kyzi007, 20 Июля 2012

    Комментарии (12)
  7. Objective C / Говнокод #11453

    −95

    1. 1
    2. 2
    NSString *currentElementValue = ...;
    int status = [[[currentElementValue copy] autorelease] intValue];

    Кто плохо понимает как работает пямять на стеке

    notxcain, 20 Июля 2012

    Комментарии (0)
  8. JavaScript / Говнокод #11452

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    var IE = '\v'=='v';
    if(IE) {
    // тут пишем обработчик для IE броузера
    }

    Самый короткий способ определения браузера IE (влючая IE.8)

    Hits, 20 Июля 2012

    Комментарии (30)
  9. Java / Говнокод #11451

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private void executeUiOperation(final UiOperation operation, final Boolean documentReadOnly) {
            boolean readOnly = !edit;
            if (documentReadOnly != null) {
                readOnly |= documentReadOnly;
            }
    //....

    Кручу-верчу запутать хочу...

    ingenuus, 20 Июля 2012

    Комментарии (14)
  10. PHP / Говнокод #11450

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    //TODO: Ахтунг! про in_array не слышали?
    $_GET['source'] = isset($_GET['source'])
          && ($_GET['filter_source'] == "manager"
             || $_GET['filter_source'] == "admin"
             || $_GET['filter_source'] == "internet"
             || $_GET['filter_source'] == "president"
             || $_GET['filter_source'] == "builder"
             || $_GET['filter_source'] == "call-center"
             || $_GET['filter_source'] == "calls"
             || $_GET['filter_source'] == "president"
             || $_GET['filter_source'] == "petr"
             || $_GET['filter_source'] == "slava"
             || $_GET['filter_source'] == "vell"
             || $_GET['filter_source'] == "box") ? $_GET['source'] : '0';

    wds, 20 Июля 2012

    Комментарии (5)