1. Python / Говнокод #9052

    −87

    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
    #!/usr/bin/python
    import itertools, math, os, random, re, sys
    random.seed (1234)
    
    while True:
            s = sys.stdin.readline ().strip ()
            if s == '':
                    s = sys.stdin.readline ().strip ()
                    if s == '':
                            break
            t = sys.stdin.readline ()
            r = sys.stdin.readline ()
            s = [c for c in s]
            t = [c for c in t]
            r = [c for c in r]
            s.sort ()
            t.sort ()
            r.sort ()
            ok = True
            for c in r:
                    if len (s) > 0 and c == s[0]:
                            s = s[1:]
                    elif len (t) > 0 and c == t[0]:
                            t = t[1:]
                    else:
                            ok = False
            ok = ok and len (s) == 0 and len (t) == 0
            if ok:
                    print 'YES'
            else:
                    print 'NO'
    
    #Люди делают так:
    #a, b, c = (raw_input() for i in range(3))
    #print 'YES' if sorted(a + b) == sorted(c) else 'NO'

    Задача такая: даны три строки: a, b и c
    проверить что третья может быть получена из двух других преремешиванием

    Источник:
    codeforces, Codeforces beta 101 round, 1018183

    VisualPaul, 08 Января 2012

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

    −108

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #import "FSAdaptor.h"
    
    @implementation FSAdaptor
    
    // NOTE: I hope that user won't manually disturb these fucking files.
    //       If this `very clever' user SUDDENLY jailbreaks his iShit and 
    //       is still thinking that it is very good app than he is wrong:
    //       if file cannot be read or is renamed or another holy shit than
    //       all methods may return complete crap and the only way for him 
    //       to be forgiven is to fuck himself. I hate these 
    //       OH-MY-GOD-I-M-MUCH-MORE-CLEVER-THAN-THESE-DEVELOPERS people!

    Не мог не запостить этот крик души. Приходится разгребать этот кусок того самого(

    stevejobs, 08 Января 2012

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

    +161

    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
    ///////////////////////////////////////////////
    ////////////
    //Содержимое
    
    function One($str,$tag,$num=1,$p=1){
    
    if($num=='0'){ $num='1'; }
    
    //Разделитель <тег
    $see_st=explode('<'.$tag,$str);
    
    if($p!==1){ $see_st=explode($p,$str); 
    
    $end=explode('>',$see_st[$num]); 
    $see_st[$num]='.'.$end[1];
    }
    
    //Разделитель </тег
    $see_end=explode('</'.$tag,substr($see_st[$num],'1'));
    
    return $see_end[0];
    }
    ///////////////////////////////////////////////
    /////////
    //Парсинг
    
    function Parse($go,$str=0){
    if($str==0){ $str=$this->String; }
    
    //Разбили путь
    $path=explode("/",$go);
    
    //Обрабатываем путь
    for($go_n=0;$go_n<count($path);$go_n++){
    //$go_n='2';
    
    //Номер тега
    $num=explode(':',$path[$go_n]);
    if($num[1]==NULL){ $num[1]=1; }
    
    if($go_n=='0'){ $string=$str;}else{ $string=$t[$go_n-1]; } 
    $t[$go_n]=$this->One($string,$num[0],$num[1]);
    }
    
    return $t[$go_n-1];
    }

    Тоже самое, но теперь с xmlD:

    finall2, 08 Января 2012

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

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function json($text,$name,$sm=0){
    //$text - текст в формате json
    //$name - название титла
    //$sm - смещение влево
    
    $text1=explode('"',$text);
    
    for ($go=0;$go<count($text1);$go++){
    if($text1[$go]==$name){ $res=$text1[$go+2-$sm]; break; }
    }
    return $res;
    }

    Грабельки)

    finall2, 08 Января 2012

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

    +163

    1. 1
    d = d ? d.push({ajax: true}) : {ajax: true};

    Похоже, что программист отметил весело новый год

    Sulik78, 08 Января 2012

    Комментарии (8)
  6. PHP / Говнокод #8970

    +157

    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
    function numword() {  
        $args = func_get_args();  
        $num = $args[0] % 100;  
         
        if ($num > 19) {  
            $num = $num % 10;  
        }  
    
        switch ($num) {  
            case 1:  { return $args[1]; }  
            case 2:  
            case 3:  
            case 4:  { return $args[2]; }  
            default: { return $args[3]; }  
        }  
    }

    Склонение слов по числам

    Skitch, 07 Января 2012

    Комментарии (6)
  7. PHP / Говнокод #8969

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    function cut($text){
    $full_text = explode("<cut/>",$text);
    return $full_text;
    }

    Функция обрезания текста по тегу <cut/>

    Skitch, 07 Января 2012

    Комментарии (39)
  8. PHP / Говнокод #8968

    +162

    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
    function tegs($str){
        if(!empty($str)){
        $tegs = explode(',', $str);
        $all_tegs = count($tegs);
        $str_Tegs = '<a href="/tegs.php?search='.$tegs['0'].'">'.$tegs['0'].'</a>';
        for($i = 1; $i<=$all_tegs-1; $i++){
            $str_Tegs .= ', <a href="/tegs.php?search='.$tegs[$i].'">'.$tegs[$i].'</a>';        
        }
        $str = $str_Tegs;
        } else {
            $str = 'Меток нет.';
        }
     return $str;
    }

    Правильный вывод меток

    Skitch, 07 Января 2012

    Комментарии (3)
  9. Python / Говнокод #8967

    −89

    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
    def getResidueList():
    	resList = []
    	resList.append("366")
    	resList.append("367")
    	resList.append("368")
    	resList.append("369")
    	resList.append("370")
    	resList.append("371")
    	resList.append("372")
    	resList.append("373")
    	resList.append("374")
    	resList.append("375")
    	resList.append("376")
    	resList.append("377")
    	resList.append("378")
    	resList.append("379")
    	resList.append("380")
    	resList.append("381")
    	resList.append("382")
    	resList.append("383")
    	resList.append("384")
    	resList.append("385")
    	resList.append("386")
    
           .... и так далее ... 
    
    	resList.append("405")
    	resList.append("406")
    	resList.append("407")
    	resList.append("408")
    	resList.append("409")
    	resList.append("410")
    	resList.append("411")
    	resList.append("412")
    	resList.append("413")
    	resList.append("414")
    
           ... и так далее ....
    
            resList.append("585")
    	resList.append("586")
    	resList.append("587")
    	resList.append("588")
    	resList.append("589")
    
    	return resList

    Циклы? Не, не слышал

    denis90, 07 Января 2012

    Комментарии (21)
  10. Куча / Говнокод #8965

    +158

    1. 1
    :)

    taras_govno, 07 Января 2012

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