1. Title Description: Click to open the link
2. Problem-Solving ideas: The topic is a simple simulation, the requirement will be less than 100 of each number of English words output, in advance to hit the table. Pay attention to the special handling of 0,11~19.
3. Code:
#define _crt_secure_no_warnings #include <iostream> #include <algorithm> #include <string> #include <sstream> #include <set> #include <vector> #include <stack> #include <map> #include < queue> #include <deque> #include <cstdlib> #include <cstdio> #include <cstring> #include < cmath> #include <ctime> #include <functional>using namespace std; #define INF 100000000#define for (i,n) for (int i=0;i< (n); i++) typedef long LONG ll;char*s[] = {"Zero", "one", "a", "three", "four", "five", "six", "seven", "Eight", "nine"};char*t[] = {0, "ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};char* Sp[] = {0, "eleven", "Twelve", "Thirteen", "fourteen", "fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};int Mai N () {//freopen ("T.txt", "R", stdin), int n;while (~SCANF ("%d", &n)) {int d = 0;int x = n;while (x > 0) {d++; x/= 10; }if (n <) {cout << s[n] << Endl;} else if (n>10&amP;&n <) {cout << sp[n-10] << Endl;} else if (d = = 2 && n% = = 0) {cout << T[N/10] << Endl;} else if (n>=20&&d = = 2 && (n% = 0)) {int x1 = N/10, x2 = n 10;cout << t[x1]<< '-' & lt;< s[x2] << Endl;}} return 0;}
#299 (Div.2) A. Tavas and Nafas