红衣主教和普通人,从1到100


28

这是一个简单的拉伸肌肉的方法。您的代码(一个完整的程序)必须输出从1到100的所有基数,然后从1到100的所有序数的英文拼写。每个列表中的数字均应由逗号和空格分隔,并正确地连字号。每个列表应以单个大写字母开头,并以句号结尾。这两个列表应该用换行符分隔。

为了清楚起见,您必须产生以下确切的字节流:

One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

这是代码高尔夫,最短答案以字节为单位。

Answers:


28

普通Lisp 88 82 80字节

(format t"~@(~{~R~^, ~}~).
~:*~@(~{~:R~^, ~}~)."(loop as i to 99 collect(1+ i)))

(这是语言的一部分,希望您不要介意)

输出量

One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

说明

请参阅格式化输出到字符流

  • (format t "<control string>" <arguments>)根据(可变)参数格式化控制字符串,并打印到标准输出(因为t

  • (loop ...) 构建从1到100的整数列表

  • ~@( ... ~) 大写由内部控制字符串返回的字符串
  • ~{ ... ~} 迭代当前参数并将内部格式应用于每个元素
  • 迭代里面,后面的一切~^不是印在最后一次迭代:这是用来添加逗号分隔空间之间的元素。
  • ~R 输出当前参数作为基数
  • ~:R 输出当前参数为序数
  • ~% 输出新行
  • ~:*当前参数重置为上一个参数,此处用于第二次重用整数列表。

感谢PrzemysławP,节省了2个字节。


1
而且我认为我的340字节答案令人印象深刻……
kirbyfan64sos 2015年

3
您的代表此时很漂亮1337!:D因此,不幸的是,我无法赞成这种解决方案... :(
Numeri说

2
@Numeri您现在可以投票。;)
DLosc 2015年

1
比输入的kolomogorov复杂性更短的解决方案总是令人印象深刻!做得好。
isaacg's

1
@DLosc打破僵局对我来说是件好事...:D
Numeri说恢复Monica 2015年

9

Pyth,366个 342 340字节

Lcbdj=Y", "++rhJy"one two three four five six seven eight nine"3+tJ+y"ten eleven twelve"+=Nm+d"teen"=by"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.jY+rh=J++y"first second third"m+d=T"th"tPby"ninth"3+++tJy"tenth eleventh twelfth"+m+dTNsm++Pd"ieth"m++d\-kJK+H"th."

现场演示。

342字节版本:

Lcbdj", "++rhJy"one two three four five six seven eight nine"3+tJ+y"ten eleven twelve"+=Nm+d"teen"=by"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.j", "+rh=J++y"first second third"m+d"th"tPby"ninth"3+++tJy"tenth eleventh twelfth"+m+d"th"Nsm++Pd"ieth"m++d\-kJK+H"th."

366字节版本:

Lcbd
j", "++"One"+tJy"one two three four five six seven eight nine"+y"ten eleven twelve"+=Nm+d"teen"y"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.
j", "+"First"+++t=Jy"first second third fourth fifth sixth seventh eighth ninth"y"tenth eleventh twelfth"+m+d"th"Nsm++Pd"ieth"m++d\-kJK+H"th."

6

PHP-491字节

这里是红衣主教的小秘籍(我使用的是PHP默认提供的NumberFormatter类):

echo'One, ';$x=new NumberFormatter(0,5);for($i=1;$i++<100;)echo$x->format($i).($i>99?
'.':', ');echo"
";$y=[First,second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,
eleventh,twelfth,thirteenth,fourteenth,fifteenth,sixteenth,seventeenth,eighteenth,nineteenth,
twentieth];for($z=[thirtieth,fortieth,fiftieth,sixtieth,seventieth,eightieth,ninetieth];
$j++<99;$q=floor($j/10),$w=$z[$q-2])echo$j<21?$y[$j-1]:($j%10?$x->format($q*10).'-'.
strtolower($y[$j%10-1]):$w),', ';echo'one hundredth.';

(增加了几行以提高可读性)


2
通常允许发出警告,删除所有@(-4个字节)。使用换行符而不是写\n(-1字节)。将的定义$z放入第二个for循环的初始化(-1个字节)。
Blackhole 2015年

通过使用过程方法而不是面向对象的构造函数,可节省6个字节
rink.attendant.6 2015年

6

PHP 5.3+,195个字节

包括换行符。

NumberFormatter就像razvan的答案一样,它是课程的一部分。除了我要根据ICU拼写基数和基数。

$f=numfmt_create(en,5);$g=clone$f;$g->setTextAttribute(6,'%spellout-ordinal');for($x=$y='',$i=1;$i++<100;){$x.=$f->format($i).($z=$i<=99?', ':'');$y.=$g->format($i).$z;}echo"One, $x.
First, $y.";

相关:https : //stackoverflow.com/a/19411974/404623


真好!我不知道%spellout-ordinal格式。
拉兹万

4

Oracle SQL 231字节

SqlFiddleLiveDemo

 SELECT 'O'||SUBSTR(LISTAGG(TO_CHAR(TO_DATE(level,'j'),'jsp'),', ')WITHIN GROUP(ORDER BY level),2)||'.','F'||SUBSTR(LISTAGG(TO_CHAR(TO_DATE(level,'j'),'jTHSP'),', ')WITHIN GROUP(ORDER BY level),2)||'.' FROM DUAL CONNECT BY level<101

3

JavaScript的ES6,562 464字节

甚至还没有打高尔夫球!

n=>(f=(a,b)=>Array(89).fill(a=btoa(a+`·§·,í*íË7躻rÍø·,ìrÎǯz{rÍè Ü³)Þ·,ó`).split`z`).map((l,i)=>i<1?b:i<20?a[i]:a[18+(i-i%10)/10]+'-'+a[i%10]).join`, `+', one hundred')(`¢w³·
3¶Þ{7躼ß÷³²,s±ëÞ7¢s)ÞÎקÍé^½éó·¥½ìí*íyéó~«µç§Íøµç§Îȱµç§Îǯz{^z|Þmyéó)Þµç§ÎÜܳ¶«·,ߢêíË7â~ܳ²,mË;½éíË7¢rÎx§µì³`,'One')+`
`+f(`~*ì·;rÝÎØb­Üߢêí7â~Øs²,m;½éí7¢Øs)Þ¶íz{aÍé^½éí;pz[Þ¶í*íyéí7躻^z{aÍøµç§¶ì^z{aÎǯz{^z{aÍè ×Øs)޵秶ó`,'First')+'th'

如果这不起作用,由于所有特殊字符,我可能需要添加一个十六进制转储如果是这种情况,请告诉我,我明天再联系。

如果有任何错别字,也请告诉我。

pastebin中的代码(在Safari Nightly上测试)

说明

这看起来像一堆乱码,但实际上非常简单。

我们从生成基数开始。使用该btoa函数压缩该数组。

['one', ..., 'eighteen', 'nineteen', 'twenty', 'thirty', ...,'ninety']

要遍历“范围”,我们使用以下方法:

现在我们使用生成一个长度为89的数组。该...是什么解压缩阵列

Array(89).fill(...)

然后通过它映射,我是索引:

.map((l,i)=>

现在,对于条件,i < 1或者如果它是第一项,我们将使用大写形式的/ first

i<1?b

否则...如果小于20,则输出11 ... 19

i<20?a[i]:

否则...使用(i-i%10)/10我们得到数字的最后一位。我们加18以补偿1..19。我们添加一个-,然后添加最后一位,即i%10

最后,我们在末尾添加“一百”,因为我们没有。

我们对两种类型的数字重复此操作,并用换行符分隔


尝试使用FireFox:发布的代码有缺陷。pastebin中的代码还可以,但是在第一个之后错过了一个句点hundred。总体而言:出色| +1
edc65'9

特殊字符是什么?
发光的

3

C ++ 704 642 620 602

除之外ostream operator<<(),没有库使用情况char*

#include<iostream>
char*q,a[]="|one|two|three|four|five|six|seven|eight|ni&u$Il%*twel&bthirte$Q(P#tif#j)/#k'L#|)y#r*4#s'9rst&>cond*5d)zh)gh)U#V)Ch)2h(}#V09$m0M$I0]'g0k)B0|*I#}1A+4$01f+y1u$$|+/nty+(y*`#X*3y)p#V)Ly))y(dyC5~hundred)Oie1o#|1c#}*E#s*a#t*}$&+9#|+T#|+uth",b[448],*s=a,*t=b;int i,j,k;auto p(int k){for(s=b;k--;)while(*s++);return s;}int main(){for(;k=*s++;)if(k>98)*t++=k<'|'?k:" "[k<'~'];else for(i=(k-35)*95+*s++-32,q=t-i/9,k=3+i%9;k--;)*t++=*q++;for(j=0;j<2;++j)for(i=1;b[1+126*j]^=32*(i<3),k=i<20?i:i%10,i<101;++i)std::cout<<p(40+!k*j*11+i/10)<<"-"[!k|i<20]<<p(j*20+k)<<", \0.\n"+i/100*3;}

现场版

有一些空格和一些注释:

#include <iostream>

// Encoded as literal characters or offset/length pairs for previous runs of characters, LZ like
char *q, a[] =
             "|one|two|three|four|five|six|seven|eight|ni&u$Il%*twel&bthirte$Q(P#tif#j)/"
             "#k'L#|)y#r*4#s'9rst&>cond*5d)zh)gh)U#V)Ch)2h(}#V09$m0M$I0]'g0k)B0|*I#}1A+4$01f+y1u$$|"
             "+/nty+(y*`#X*3y)p#V)Ly))y(dyC5~hundred)Oie1o#|1c#}*E#s*a#t*}$&+9#|+T#|+uth",
         b[448], *s = a, *t = b;

int i, j, k;

// Find the kth null separated string in array b
auto p(int k) {
    for (s = b; k--;)
        while (*s++)
            ;
    return s;
}

int main() {
    // Decode the compressed 'primitives' we use to build up the output.
    for (; k = *s++;)
        if (k > 98)
            *t++ = k < '|' ? k : " "[k < '~'];
        else
            for (i = (k - 35) * 95 + *s++ - 32, q = t - i / 9, k = 3 + i % 9; k--;) *t++ = *q++;

    // Loop twice over numbers 1-100, building up output from the 'primitives' in our array
    for (j = 0; j < 2; ++j)
        for (i = 1; b[1 + 126 * j] ^= 32 * (i < 3), k = i < 20 ? i : i % 10, i < 101; ++i)
            std::cout << p(40 + !k * j * 11 + i / 10) << "-"[!k | i < 20] << p(j * 20 + k)
                      << ", \0.\n" + i / 100 * 3;
}

压缩后的字符串从解码ab

|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|
sixteen|seventeen|eighteen|nineteen||first|second|third|fourth|fifth|sixth|seventh|eighth|
ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|
eighteenth|nineteenth|||twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|one~
hundred|||twentieth|thirtieth|fourtieth|fiftieth|sixtieth|seventieth|eightieth|
ninetieth|one~hundredth;

没有换行符。在解压缩期间,将|s替换为'\0',将~s替换为' '(将字符编码为可打印ASCII的方式有所不同)。然后b使用数组中的索引在数组中通过索引查找这些“原始”字符串p函数并将其用于组合输出。

压缩是一种类似于LZ的简单方案,其中字符被编码为文字或缓冲区中的负偏移量,并且如果发现长度> = 3,则将游程长度(编码为两个字符)编码。可以使用不可打印的字符进一步压缩字符串,但我希望代码可以安全复制和粘贴:)


1

Javascript(ES6),713

类似于我关于这个问题的第二份PHP提交。(2444-713)/ 2444 = 70.8%压缩率。

a=`Onez]cu^dP~Ntenz\`zHlvezmwgwjwkw{wqwpwHnQxZx]xcxux^xdxPx~xNmQXZX]XcXuX^XdXPX~XNforQbZb]bcbub^bdbPb~bNjQWZW]WcWuW^WdWPW~WNkQVZV]VcVuV^VdVPV~VN{QUZU]UcUuU^UdUPU~UNqQTZT]TcTuT^TdTPT~TNpQSZS]ScSuS^SdSPS~SNy.
FirstzaRMLKJI[ten}\`}Hlf}mGgGjGkG{GqGpGHnYx_xaxRxMxLxKxJxIx[mYX_XaXRXMXLXKXJXIX[forYb_babRbMbLbKbJbIb[jYW_WaWRWMWLWKWJWIW[kYV_VaVRVMVLVKVJVIV[{YU_UaURUMULUKUJUIU[qYT_TaTRTMTLTKTJTIT[pYS_SaSRSMSLSKSJSIS[yth.`,'eleven|`}|`z|twe|q}|{}|k}|j}|g}|pz|{z|kz|gz|one hundred|tyz|mdz|qtz|p~|q~|{~|k~|j~|m~|tie}|onez|nin}|twoz|fivez|firstz|teen|threez|secondz|for~|four|fif|twen~|six|thir|nine|eigh|, |seven|th, |ty-'.split('|').map((e,i)=>a=a.split('`GwHIJKLMNPduyQR~STUVWXYZ[]^_`cabgjxkmpqz{}~'[i]).join(e)),alert(a)

小提琴


为什么这被否决?
DankMemes 2015年

1

数学415 391 407

红衣主教由给出IntegerName[n]。序数来自基数。

s = StringRiffle; y = IntegerName; t = StringReplace;
k@n_ := If[(z = (TextWords["first second third a fifth a a a ninth,a, a twelfth a a a a a eighteenth a, twentieth"])[[n]]) == "a", y@n <> "th", z]
g@n_ := Module[{i = IntegerDigits[n], z}, z := y[Quotient[n, 10]*10];Which[n == 100, "one hundredth", n < 20, k[n], i[[-1]] == 0, t[z, "y" -> "ieth"], 3 > 2, z <> "-" <> k[i[[-1]]]]]
t[(s[y@Range@100 /. "one" -> "One", ", "] <> ".") <> s[g /@ Range@100 /. "first" -> "\nFirst", ", "] <> ".", "tt" -> "t"]

输出:

One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

1
有些uncorrecteightth
马里奥特鲁科

你是对的!我现在纠正了它们。
DavidC

您可以更改"first" -> "\nFirst""fir" -> "\nFir"保存4个字节。
LegionMammal978'9

@ LegionMamal978,很好的建议,但是它不起作用,因为我们要替换列表中的元素(单词):“ first”是列表中的元素,而“ fir”则不是。如果我们在StringJoin编辑元素列表之后尝试执行您的建议,则“二十一...三十一...”将变为“二十一...三十一...”。
DavidC 2015年

1

JavaScript(ES6),480

/*TEST: redirect console output to snippet body */ console.log=x=>O.innerHTML=x

// Not a function, as a complete program is requested
b=x=>btoa(x).split`/`;
Z=i=>z[i]||z[i-8]||z[i-18];
y=b("ýø«²ßìyÊ'wûa·ýøÿÿÞ)ÿÿûpzWÿÿÿÿÿÿÿ");
z=b("þÞþÜ(þØkyïߢêÿ~+ÞþȱþǯzÞmþx§{û^÷¥z÷§þÜ÷¿¶«ÿ÷âÿÿz(!ÿûpzÿ~ÿÿÿÿ");
o=(z.map((v,i)=>i<20?i<13?v:(v||z[i-10])+'teen':z[S='slice'](0,10).map(d=>Z(i)+(d?'ty-'+d:'ty')))+`,${h='one hundred'}.\nF`).split`,`;
q=y.map((v,i)=>i<4?v:`${v||o[i]}th`);
q=z.map((v,i)=>i<20?' '+q[i]:q[S](0,10).map(d=>' '+Z(i)+(d?'ty-'+d:'tieth')));
console.log('O'+o.join`, `[S](3)+`${q}, ${h}th.`[S](4))

// INFO: z uncompressed is [,one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,,fif,,,eigh,,twen,,for,,,,,]
// INCO: y uncompressed is [,first,second,third,,fif,,,eigh,nin,,,twelf,,,,,,,,,]
#O { white-space: pre-wrap }
<pre id=O></pre>


0

PHP-842字节

省略常规的PHP开始和结束标签,压缩率为1-842/2445 = 65.6%

基本上获取输出base64_encode(gzdeflate($input, 9));并反转操作。显然,如果我选择以纯8位而不是base-64输出,它将缩小25%,但存在遇到转义符或不可打印字符的风险。

echo gzinflate(base64_decode('VZRdcuIwEITfcwoOQHKMfd1DBGnlKspUEYfEt1+rf2bGL6gbkLplS9/ftV0v28/j+BjPduj++H4en8vr0F/L7/HRXm29Xtryb2zXy7pgAr6585ftp93nv7exPLc2v5lrSC2d4lhKYk6ixJJQc1WqY7F12z2+P1gPmi2lWVaOnW1QXQY7sI6602k/ctrW3MHuUeHUekTUCqdTuMzyyl8YLq1wOofTMbw/kI2B0ZRIlvQrylxpxFIjVZKhNMqkUeTxdnYNioRkJKUiYXw2ekZCM5JSkTCOhGHkPAe7BkZSIlKSkTSMlPahdKQkI2kUSaNInLg9hGJlGGyjaFmF2zFeLu9GqSDrErKsgS93jywhjQ7WrCDHBjYoIIN863JFI12O4bhgu0eGSyPcmuFyDLdBuAzCrRkuVzAR4UfaZXyvt2e7fbz9WZ5feDafj/XGK3ATMQaPyuDrG36AQ3sZWHYOm769+/eJIEw0g7CWKOR1JUWiXL+VDGnzSGuv29JCzkeBLQRWtBOTCRsqZDrN7MVplxVPxXvPSajYoNoYOWxjzuRzLW0SVaeZvTi3KbwqPtoEsviIXcYcQhfTh1XMLr3oWsSzehrVKABL6xLBML9adRCY2EE4UgfBjB0CZnVWT+MOSbS00cFQ85liB5OKh1x8YgfTDR2SbnVWT+MrkIhL6w5BuTzMahHI0mV7nY5q4o5dCu7Os3u1p0tZO1XqjRP24l6xVnAMrQJeLBX8Q6fCv9PMXpwKVQgW7zrJwbjZbBNgQ5ugGdsEENGmAPE0sxenNpWKxReCtWxTyLiNj7f/'));
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.