# 多边形前缀

17

``````3 - tri
4 - tetra
5 - penta
6 - hexa
7 - hepta
8 - octa
9 - nona
10 - deca
11 - undeca
12 - dodeca
13 - triskaideca
20 - icosa
``````

``````10 - deca        | 1 - hena
20 - icosi       | 2 - di
30 - triaconta   | 3 - tri
40 - tetraconta  | 4 - tetra
50 - pentaconta  | 5 - penta
60 - hexaconta   | 6 - hexa
70 - heptaconta  | 7 - hepta
80 - octaconta   | 8 - octa
90 - nonaconta   | 9 - nona
``````

ugoren 2013年

ugoren

@ beary605我认为nona-是错误的。那将来自拉丁语，而其他的七，六则来自希腊。应该是ennea-。我知道维基百科说nagon可以！
felipa

@felipa：我正在讨论是否要使用它`ennea-`，但是我比“ enneagon”更经常听到“ nonagon”，所以我同意了。
beary605

@ugoren：100-公顷，我没有发现我没有`deca`，谢谢。110-八角形，120-六角形。101-hectakaihenagon。
beary605

5

## C，401，391

``````char*s[]={"","hena","di","tri","tetra","penta","hexa","hepta","octa","nona","un","do","triskai","deca","icosi","tria","conta","kai","icosa","hecto","hecta","gon\n"};
p(i){printf(s[i]);}
t;n(i){
if(i<10)
p(i);   // ones
else if(i<20){
i-=10;
p(i+(i&&i<4)*9); // teens
p(13); // "deca"
}else if(i==20)
p(18); // "icosa"
else if(i==100)
p(19); // "hecto"
else{
t=i/100;
p(t>1?t:0); // hundreds
p(t?20:0);  // "hecta"
i%=100;
t=i/10;
p(t+(t&&t<4)*12); // tens
p(t>2?16:0);      // "conta"
i%=10;
p(i?17:0); // "kai"
p(i);      // ones
}
p(21); // "gon\n"
}
``````

``````main(){
for(int i=3;i<=999;i++){
printf("%3d: ",i);n(i);
}
}
``````

``````  3: trigon
4: tetragon
5: pentagon
6: hexagon
7: heptagon
8: octagon
9: nonagon
10: decagon
11: undecagon
12: dodecagon
13: triskaidecagon
20: icosagon
21: icosikaihenagon
22: icosikaidigon
23: icosikaitrigon
...
99: nonacontakainonagon
100: hectogon
101: hectakaihenagon
102: hectakaidigon
103: hectakaitrigon
104: hectakaitetragon
105: hectakaipentagon
106: hectakaihexagon
107: hectakaiheptagon
108: hectakaioctagon
109: hectakainonagon
...
997: nonahectanonacontakaiheptagon
998: nonahectanonacontakaioctagon
999: nonahectanonacontakainonagon
``````

1

ugoren

1

## JavaScript的- 405 386

``````i=prompt(),o='0hena0di0tri0tetra0penta0hexa0hepta0octa0nona'.split(0),d='0W0icosi0triaQ0tetraQ0pentaQ0hexaQ0heptaQ0octaQ0nonaQ'.split(0),t='W0unW0doW0triskaiW0tetraW0pentaW0hexaW0heptaW0octaW0nonaW0icosa'.split(0),x=('000'+i).substr(-3).split('');alert((i<10?o[i]:i<21?t[i-10]:i==100?'hecto':(i<100?'':i<200?'hecta':o[x[0]]+'hecta')+d[x[1]]+'kai'+o[x[2]]).replace(/Q/g,'conta').replace(/W/g,'deca')+'gon')
``````

``````i=prompt(),p='0tetra0penta0hexa0hepta0octa0nona',o='0hena0di0tri'+p,t=('W0unW0doW0triskai'+p.replace(/0/g,'W0')+'W0icosa').split(0),x=('000'+i).substr(-3).split(''),o=o.split(0);alert((i<10?o[i]:i<21?t[i-10]:i==100?'hecto':(i<100?'':i<200?'hecta':o[x[0]]+'hecta')+('0W0icosi0tria'+p.replace(/0/g,'Q0')+'Q').split(0)[x[1]]+'kai'+o[x[2]]).replace(/Q/g,'conta').replace(/W/g,'deca')+'gon')
``````

``````3: trigon
4: tetragon
5: pentagon
6: hexagon
7: heptagon
8: octagon
9: nonagon
10: decagon
11: undecagon
12: dodecagon
13: triskaidecagon
20: icosagon
21: icosikaihenagon
22: icosikaidigon
23: icosikaitrigon
99: nonacontakainonagon
...
100: hectogon
101: hectakaihenagon
102: hectakaidigon
103: hectakaitrigon
104: hectakaitetragon
105: hectakaipentagon
106: hectakaihexagon
107: hectakaiheptagon
108: hectakaioctagon
109: hectakainonagon
...
997: nonahectanonacontakaiheptagon
998: nonahectanonacontakaioctagon
999: nonahectanonacontakainonagon
``````

0

# 眼镜蛇-370字节

``````def f(x) as String
o='. hena di tri tetra penta hexa hepta octa nona'.split
o[0],t,h,d='',['','deca','icosci','triconta'],['','hecta','dihecta','trihecta'],['undeca','dodeca','triskaideca']
for z in 4:10,t,h,d=t+[o[z]+'conta'],h+[o[z]+'hecta'],d+[o[z]+'deca']
for z in 10,t[z]+='kai'
return if(x-100,h[x//100]+if(10<x<20,d[x-11],t[x%100//10]+o[x%10]),'hecto')+'gon'
``````