# 整数转换英文表示

<p>将非负整数 <code>num</code> 转换为其对应的英文表示。</p>

<p> </p>

<p><strong>示例 1：</strong></p>

<pre>
<strong>输入：</strong>num = 123
<strong>输出：</strong>"One Hundred Twenty Three"
</pre>

<p><strong>示例 2：</strong></p>

<pre>
<strong>输入：</strong>num = 12345
<strong>输出：</strong>"Twelve Thousand Three Hundred Forty Five"
</pre>

<p><strong>示例 3：</strong></p>

<pre>
<strong>输入：</strong>num = 1234567
<strong>输出：</strong>"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"
</pre>

<p><strong>示例 4：</strong></p>

<pre>
<strong>输入：</strong>num = 1234567891
<strong>输出：</strong>"One Billion Two Hundred Thirty Four Million Five Hundred Sixty Seven Thousand Eight Hundred Ninety One"
</pre>

<p> </p>

<p><strong>提示：</strong></p>

<ul>
	<li><code>0 <= num <= 2<sup>31</sup> - 1</code></li>
</ul>


## template

```cpp
#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    const int Mod[3] = {1000000000, 1000000, 1000};
    string H[3] = {"Billion", "Million", "Thousand"},
           M[8] = {"Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"},
           L[20] = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
                    "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};
    void update(string &ans)
    {
        ans += ans == "" ? "" : " ";
    }
    string numberToWords2(int num)
    {
        if (num < 20)
            return L[num];
        string ans;
        if (num >= 100)
            ans += L[num / 100] + " Hundred", num %= 100;
        if (num == 0)
            return ans;
        else if (num < 20)
            update(ans), ans += L[num];
        else
        {
            update(ans), ans += M[num / 10 - 2], num %= 10;
            if (num == 0)
                return ans;
            else
                update(ans), ans += L[num];
        }
        return ans;
    }
    string numberToWords(int num)
    {
        if (num < 20)
            return L[num];
        string ans;
        for (int i = 0; i < 3; ++i)
            if (num >= Mod[i])
                update(ans), ans += numberToWords2(num / Mod[i]) + " " + H[i], num %= Mod[i];
        if (num)
            update(ans), ans += numberToWords2(num);
        return ans;
    }
};

```

## 答案

```cpp

```

## 选项

### A

```cpp

```

### B

```cpp

```

### C

```cpp

```