1. C++ / Говнокод #19237

    −104

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #define in(x,mn,mx) ((x) >= (mn) && (x) <= (mx))
    bool IsBukva(char c)
    {	
    	if( in(c,65,90) || in(c,97,122) || in(c,170,170) || in(c,181,181) || in(c,186,186) || in(c,192,214) || in(c,216,246) || in(c,248,705) || in(c,710,721) || in(c,736,740) || in(c,748,748) || in(c,750,750) || in(c,880,884) || in(c,886,887) || in(c,890,893) || in(c,902,902) || in(c,904,906) || in(c,908,908) || in(c,910,929) || in(c,931,1013) || in(c,1015,1153) || in(c,1162,1315) || in(c,1329,1366) || in(c,1369,1369) || in(c,1377,1415) || in(c,1488,1514) || in(c,1520,1522) || in(c,1569,1610) || in(c,1646,1647) || in(c,1649,1747) || in(c,1749,1749) || in(c,1765,1766) || in(c,1774,1775) || in(c,1786,1788) || in(c,1791,1791) || in(c,1808,1808) || in(c,1810,1839) || in(c,1869,1957) || in(c,1969,1969) || in(c,1994,2026) || in(c,2036,2037) || in(c,2042,2042) || in(c,2308,2361) || in(c,2365,2365) || in(c,2384,2384) || in(c,2392,2401) || in(c,2417,2418) || in(c,2427,2431) || in(c,2437,2444) || in(c,2447,2448) || in(c,2451,2472) || in(c,2474,2480) || in(c,2482,2482) || in(c,2486,2489) || in(c,2493,2493) || in(c,2510,2510) || in(c,2524,2525) || in(c,2527,2529) || in(c,2544,2545) || in(c,2565,2570) || in(c,2575,2576) || in(c,2579,2600) || in(c,2602,2608) || in(c,2610,2611) || in(c,2613,2614) || in(c,2616,2617) || in(c,2649,2652) || in(c,2654,2654) || in(c,2674,2676) || in(c,2693,2701) || in(c,2703,2705) || in(c,2707,2728) || in(c,2730,2736) || in(c,2738,2739) || in(c,2741,2745) || in(c,2749,2749) || in(c,2768,2768) || in(c,2784,2785) || in(c,2821,2828) || in(c,2831,2832) || in(c,2835,2856) || in(c,2858,2864) || in(c,2866,2867) || in(c,2869,2873) || in(c,2877,2877) || in(c,2908,2909) || in(c,2911,2913) || in(c,2929,2929) || in(c,2947,2947) || in(c,2949,2954) || in(c,2958,2960) || in(c,2962,2965) || in(c,2969,2970) || in(c,2972,2972) || in(c,2974,2975) || in(c,2979,2980) || in(c,2984,2986) || in(c,2990,3001) || in(c,3024,3024) || in(c,3077,3084) || in(c,3086,3088) || in(c,3090,3112) || in(c,3114,3123) || in(c,3125,3129) || in(c,3133,3133) || in(c,3160,3161) || in(c,3168,3169) || in(c,3205,3212) || in(c,3214,3216) || in(c,3218,3240) || in(c,3242,3251) || in(c,3253,3257) || in(c,3261,3261) || in(c,3294,3294) || in(c,3296,3297) || in(c,3333,3340) || in(c,3342,3344) || in(c,3346,3368) || in(c,3370,3385) || in(c,3389,3389) || in(c,3424,3425) || in(c,3450,3455) || in(c,3461,3478) || in(c,3482,3505) || in(c,3507,3515) || in(c,3517,3517) || in(c,3520,3526) || in(c,3585,3632) || in(c,3634,3635) || in(c,3648,3654) || in(c,3713,3714) || in(c,3716,3716) || in(c,3719,3720) || in(c,3722,3722) || in(c,3725,3725) || in(c,3732,3735) || in(c,3737,3743) || in(c,3745,3747) || in(c,3749,3749) || in(c,3751,3751) || in(c,3754,3755) || in(c,3757,3760) || in(c,3762,3763) || in(c,3773,3773) || in(c,3776,3780) || in(c,3782,3782) || in(c,3804,3805) || in(c,3840,3840) || in(c,3904,3911) || in(c,3913,3948) || in(c,3976,3979) || in(c,4096,4138) || in(c,4159,4159) || in(c,4176,4181) || in(c,4186,4189) || in(c,4193,4193) || in(c,4197,4198) || in(c,4206,4208) || in(c,4213,4225) || in(c,4238,4238) || in(c,4256,4293) || in(c,4304,4346) || in(c,4348,4348) || in(c,4352,4441) || in(c,4447,4514) || in(c,4520,4601) || in(c,4608,4680) || in(c,4682,4685) || in(c,4688,4694) || in(c,4696,4696) || in(c,4698,4701) || in(c,4704,4744) || in(c,4746,4749) || in(c,4752,4784) || in(c,4786,4789) || in(c,4792,4798) || in(c,4800,4800) || in(c,4802,4805) || in(c,4808,4822) || in(c,4824,4880) || in(c,4882,4885) || in(c,4888,4954) || in(c,4992,5007) || in(c,5024,5108) || in(c,5121,5740) || in(c,5743,5750) || in(c,5761,5786) || in(c,5792,5866) || in(c,5888,5900) || in(c,5902,5905) || in(c,5920,5937) || in(c,5952,5969) || in(c,5984,5996) || in(c,5998,6000) || in(c,6016,6067) || in(c,6103,6103) || in(c,6108,6108) || in(c,6176,6263) || in(c,6272,6312) || in(c,6314,6314) || in(c,6400,6428) || in(c,6480,6509) || in(c,6512,6516) || in(c,6528,6569) || in(c,6593,6599) || in(c,6656,6678) || in(c,6917,6963) || in(c,6981,6987) || in(c,7043,7072) || in(c,7086,7087) || in(c,7168,7203) || in(c,7245,7247) || in(c,7258,7293) || in(c,7424,7615) || in(c,7680,7957) || in(c,7960,7965) || in(c,7968,8005) || in(c,8008,8013) || in(c,8016,8023) || in(c,8025,8025) || in(c,8027,8027) || in(c,8029,8029) || in(c,8031,8061) || in(c,8064,8116) || in(c,8118,8124) || in(c,8126,8126) || in(c,8130,8132) || in(c,8134,8140) || in(c,8144,8147) || in(c,8150,8155) || in(c,8160,8172) || in(c,8178,8180) || in(c,8182,8188) || in(c,8305,8305) || in(c,8319,8319) || in(c,8336,8340) || in(c,8450,8450) || in(c,8455,8455) || in(c,8458,8467) || in(c,8469,8469) || in(c,8473,8477) || in(c,8484,8484) || in(c,8486,8486) || in(c,8488,8488) || in(c,8490,8493) || in(c,8495,8505) || in(c,8508,8511) || in(c,8517,8521) || in(c,8526,8526) || in(c,8579,8580) || in(c,11264,11310) || in(c,11312,11358) || in(c,11360,11375) || in(c,11377,11389) || in(c,11392,11492) || in(c,11520,11557) || in(c,11568,11621) || in(c,11631,11631) || in(c,11648,11670) || in(c,11680,11686) || in(c,11688,11694) || in(c,11696,11702) || in(c,11704,11710) || in(c,11712,11718) || in(c,11720,11726) || in(c,11728,11734) || in(c,11736,11742) || in(c,11823,11823) || in(c,12293,12294) || in(c,12337,12341) || in(c,12347,12348) || in(c,12353,12438) || in(c,12445,12447) || in(c,12449,12538) || in(c,12540,12543) || in(c,12549,12589) || in(c,12593,12686) || in(c,12704,12727) || in(c,12784,12799) || in(c,13312,19893) || in(c,19968,32765) ) return 1;
    	return 0;
    }

    IsBukva - переосмысление

    Запостил: glauberov, 25 Декабря 2015

    Комментарии (13) RSS

    • это ещё ок, вы бы видели, как лексер GHC юникод обрабатывает...
      Ответить
    • Я б то же самое хотя б в двоичное дерево перевёл, чтоб не линейно искать.
      Ответить
    • Я пропустил момент когда в плюсах char стал > 1 байта?
      Ответить
      • Чар всегда один байт. Но байт может быть больше 8 бит.
        Ответить
        • Хоть биты двоичные, и то радость.
          Ответить
          • А где в стандарте об этом написано?
            Ответить
            • 3.9.1 Fundamental types

              7. Types bool, char, wchar_t, and the signed and unsigned integer types are collectively called integral types. A synonym for integral type is integer type. The representations of integral types shall define values by use of a pure binary numeration system (49).

              49) A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, begin with 1, and are multiplied by successive integral power of 2, except perhaps for the bit with the highest position
              Ответить
    • bool IsBog (float Grehi) {
          ...
      }
      Ответить

    Добавить комментарий