1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 using namespace std;
5 char num[30][10]=
6 {
7 "",
8 "one",
9 "two",
10 "three",
11 "four",
12 "five",
13 "six",
14 "seven",
15 "eight",
16 "nine",
17 "ten",
18 "eleven",
19 "twelve",
20 "thirteen",
21 "fourteen",
22 "fifteen",
23 "sixteen",
24 "seventeen",
25 "eighteen",
26 "nineteen"
27 };
28 char ten[10][10]=
29 {
30 "",
31 "ten",
32 "twenty",
33 "thirty",
34 "forty",
35 "fifty",
36 "sixty",
37 "seventy",
38 "eighty",
39 "ninety"
40 };
41 char hund[10]="hundred";
42 char thou[10]="thousand";
43
44 int main()
45 {
46 //freopen("d:\\in.txt","w",stdout);
47 int ans=0;
48 for(int i=1; i<1000; i++)
49 {
50 if(i<20)
51 {
52 ans+=strlen(num[i]);
53 cout<<num[i]<<endl;
54 }
55 else if(i<100)
56 {
57 if(i%10==0)
58 {
59 ans+=strlen(ten[i/10]);
60 cout<<ten[i/10]<<endl;
61 }
62 else
63 {
64 ans+=strlen(ten[i/10])+strlen(num[i%10]);
65 cout<<ten[i/10]<<"-"<<num[i%10]<<endl;
66 }
67
68 }
69 else if(i%100==0)
70 {
71 ans+=strlen(num[i/100])+strlen(hund);
72 cout<<num[i/100]<<" "<<hund<<endl;
73 }
74 else
75 {
76 if(i%100<20)
77 {
78 ans+=strlen(num[i/100])+strlen(hund)+3+strlen(num[i%100]);
79 cout<<num[i/100]<<" "<<hund<<" and "<<num[i%100]<<endl;
80 }
81 else
82 {
83 if(i%10==0)
84 {
85 ans+=strlen(num[i/100])+strlen(hund)+3+strlen(ten[i/10%10]);
86 cout<<num[i/100]<<" "<<hund<<" and "<<ten[i/10%10]<<endl;
87 }
88 else
89 {
90 ans+=strlen(num[i/100])+strlen(hund)+3+strlen(ten[i/10%10])+strlen(num[i%10]);
91 cout<<num[i/100]<<" "<<hund<<" and "<<ten[i/10%10]<<"-"<<num[i%10]<<endl;
92 }
93
94 }
95
96 }
97 }
98 ans+=strlen(thou)+3;
99 cout<<ans<<endl;
100 }