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

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

    +1

    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
    /* Python:
    
    def A004086(n):
    return int(str(n)[::-1])
    */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    int A004086(int n) {
        char str[12]; // Enough to hold the string representation of an int
        sprintf(str, "%d", n);
        int len = strlen(str);
        char reversed[12];
        
        for (int i = 0; i < len; i++) {
            reversed[i] = str[len - 1 - i];
        }
        reversed[len] = '\0'; // Null-terminate the string
        
        return atoi(reversed);
    }

    Результат переписывание с "Python" на "C". A004086 это последовательность из OEIS https://oeis.org/A004086

    j123123, 02 Января 2025

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