1. Лучший говнокод

    В номинации:
    За время:
  2. Си / Говнокод #18030

    +142

    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
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    #include <inttypes.h>
    #include <stdio.h>
     
    typedef union
    {
      struct
      {
        #define BITG(n) uint8_t bit##n : 1
        BITG(0);
        BITG(1);
        BITG(2);
        BITG(3);
        BITG(4);
        BITG(5);
        BITG(6);
        BITG(7);
        #undef BITG
      } bits;
      uint8_t value;
    }getbit;
     
    uint8_t bit_sum(uint8_t, uint8_t);
     
     
    uint8_t bit_sum(uint8_t a, uint8_t b)
    {
      getbit op1, op2, opr;
      uint8_t carry;
      op1.value=a; op2.value=b;
      #define OP1(n) op1.bits.bit##n
      #define OP2(n) op2.bits.bit##n
      #define OPR(n) opr.bits.bit##n
      #define XOR(a,b) ((a)^(b))
      #define AND(a,b) ((a)&(b))
      OPR(0) = XOR(OP1(0), OP2(0));
      carry = AND(OP1(0), OP2(0));
      #define SETBIT(n)                \
      OPR(n) = XOR                     \
               (                       \
                 carry,                \
                 XOR(OP1(n), OP2(n))   \
               );
     
      #define CARRYBIT(n)              \
      carry = XOR                      \
              (                        \
                AND(OP1(n), OP2(n)),   \
                AND                    \
                (                      \
                  XOR(OP1(n), OP2(n)), \
                  carry                \
                )                      \
              );
      SETBIT(1);
      CARRYBIT(1);
      SETBIT(2);
      CARRYBIT(2);
      SETBIT(3);
      CARRYBIT(3);
      SETBIT(4);
      CARRYBIT(4);
      SETBIT(5);
      CARRYBIT(5);
      SETBIT(6);
      CARRYBIT(6);
      SETBIT(7);
      return opr.value;
      #undef SETBIT
      #undef CARRYBIT
      #undef OP1
      #undef OP2
      #undef OPR
      #undef XOR
      #undef AND
    }
     
    int main (int argc, char *argv[], char *envp[])
    {
      uint8_t a, b, c;
      scanf ("%"SCNu8"%"SCNu8, &a, &b);
      c = bit_sum(a,b);
      printf("%"PRIu8"\n", c);
      return 0;
    }

    Побитовое сложение двух 8-битных чисел по схеме двоичного сумматора

    j123123, 20 Апреля 2015

    Комментарии (11)
  3. PHP / Говнокод #18029

    +142

    1. 1
    echo (yaml_parse_file('schema.yaml')['Article']['fields']['title']);

    artembegood, 20 Апреля 2015

    Комментарии (0)
  4. C++ / Говнокод #18025

    +142

    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
    27. 27
    28. 28
    29. 29
    30. 30
    #include <iostream>
    #include <iomanip>
    #include <vector>
    using namespace std;
    int possition[65535] = {0};
    int sum[65535] = {0};
     
    int main() {
    int i=0;
    int j=0;
    int N;
    cin >> N;
    for(i=0; i<N; i++)
    cin >> possition[i];
     
    for(i=0; i<N; i++){                  
    for(j=0; j<possition[i]; j++){
             if(sum[i]<=possition[i]-j){
             sum[i]+=j;}
             
    }
           
    if(possition[i]-sum[i]==1)
    cout<<1<<" ";
    else cout<<0<<" ";
     
    }
     
    return 0;
    }

    Забавное это дело - листать новые пасты на pastebin'е.

    gost, 20 Апреля 2015

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

    +142

    1. 1
    return st1.empty() || st2.empty() ? st1.empty() && st2.empty() ? 0 : st1.empty() ? st2.gcd() : st1.gcd() : qwer::gcd(st1.gcd(), st2.gcd());

    Когда увлёкся условными конструкциями...

    AndreyZ, 18 Апреля 2015

    Комментарии (5)
  6. Си / Говнокод #17635

    +142

    1. 1
    2. 2
    #define PHYSICAL        unsigned long
    #define VIRTUAL         unsigned long

    прикольное legacy

    cerevra, 13 Февраля 2015

    Комментарии (14)
  7. Си / Говнокод #17385

    +142

    1. 1
    return (guint)(((double)(((double)((SAMPLERATE_48KHZ)) / (((double)(fps_numerator) / (double)(fps_denominator)))))));

    Фу, блять.

    codemonkey, 29 Декабря 2014

    Комментарии (55)
  8. C# / Говнокод #17068

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    string.Format(
        "{0}{3}{1}{4}{2}",
        MrzRfid.Split(';')[0],
        MrzRfid.Split(';')[1],
        MrzRfid.Split(';')[2],
        Environment.NewLine,
        Environment.NewLine);

    Есть строка, которая состоит из 3х логических частей, разделеных символом ';'.
    Этот код разбивает эти 3 части по строкам

    NeoN, 05 Ноября 2014

    Комментарии (41)
  9. Куча / Говнокод #16977

    +142

    1. 1
    <img title="(495) 980-68-49" alt="(495) 980-68-49" src="/images/phones/9c1fc37d7d851137eca84579f7346b66">

    Защита от граба данных
    Уровень: Бог

    http://www.plan1.ru/podolsk/magazinyi/salonyi-svyazi/

    dekameron, 29 Октября 2014

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

    +142

    1. 1
    2. 2
    3. 3
    // string errorMessage;
    if (result == false)
       result = true; //because model is not changed

    because

    sharpman, 24 Октября 2014

    Комментарии (10)
  11. C# / Говнокод #16197

    +142

    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
    public Config(string[] str)
            {
                InitializeComponent();
                try
                {
                    textBox5.Text = str[0];
                    textBox6.Text = str[1];
                    textBox1.Text = str[2];
                    textBox2.Text = str[3];
                    textBox3.Text = str[4];
                    textBox4.Text = str[5];
                    textBox7.Text = str[6];
                    raz = str[7];
                }
                catch (Exception)
                {
                    return;
                }
            }

    Классика. Говнокод эпохи барокко. Строк мало, но пованивает.

    GreatMASTERcpp, 19 Июня 2014

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