Time limit: 1.0 s memory limit: 512.0 MB
Problem description
Tom professor was giving a postgraduate taught a course about genes, there is one thing that made him quite a headache: a chromosome has tens of thousands of base pairs, they are numbered starting from 0, to millions, tens of millions, even hundreds of millions of,
For example, on the bases of students on 1234567009th position, light look at the Numbers is difficult to accurately read aloud,
So, he desperately needs a system, and then when he enter 12, 3456, 7009, gives the corresponding reading method:
One billion two hundred and thirty-four million five hundred and sixty-seven thousand and nine
In Chinese pinyin is expressed as
Shi er yi SAN qian si bai wu shi liu wan qi qian ling jiu
According this way, he just need to read,
Your task is to help him to design such a system: given a Arabic numeral string, you help him according to the standard of Chinese, speaking, reading and writing into Chinese pinyin string, the adjacent two syllables FuGe open with a blank,
Notice must be in strict accordance with the specification, such as "10010" pronounced "yi wan ling yi shi" rather than "yi wan ling shi", "100000" pronounced "shi wan" instead of "yi shi wan", "2000" pronounced "er qian" rather than "liang qian",
Input format
A numeric string, numeric size does not exceed 2000000000,
The output format
Is a lowercase English letters, commas and Spaces of string, said the number of the English pronunciation,
The sample input
1234567009
Sample output
Shi er yi SAN qian si bai wu shi liu wan qi qian ling jiu
A piece of code:
#include
using namespace std;
Void the read (int flag, int d1, int d2, int d3, int d4);
String STR [11]={" zero ", "yi", "er", "SAN", "si", "wu", "liu", "qi" and "ba", "jiu", "shi"};
Int main ()
{
String s;
Cin> s;
Int num=s.l ength ();
Int a [10]={0};
int i=0;
Int b, c, d;
While (s [I]!='\ 0') {
A 10 - num + [I]=s [I] - '0';
i++;
}
Int flag=0;
If (num> 8) {
flag=1;
B=a [0] * 10 + a, [1].
If (b> 10) {
cout
The else {
cout
Read (flag, a [2], a [3], a [4], a [5]);
cout<" Wan "& lt; <" ";
Read (flag, a [6], a [7], a [8], a [9]);
}
If (num> 4 & amp; & Num<{
=8)flag=1;
Read (0, a [2], a [3], a [4], a [5]);
cout<" Wan "& lt; <" ";
Read (flag, a [6], a [7], a [8], a [9]);
}
If (num<{
=4)Read (flag, a [6], a [7], a [8], a [9]);
return 0;
}
}
Void the read (int flag, int d1, int d2, int d3, int d4) {
If (d1 & gt; 0 {
cout
cout
cout
cout
}
The else {
If (d4 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
}
}
The else {
If (d3 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
cout
}
The else {
If (d4 & gt; 0 {
cout
}
}
}
The else {
If (flag==1) {
If (d2 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
cout
cout
}
The else {
If (d4 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
}
}
The else {
If (d3 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
cout
}
The else {
If (d4 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
}
}
}
The else {
If (d2 & gt; 0 {
cout
cout
cout
}
The else {
If (d4 & gt; 0 {
cout<" Ling "& lt; <" ";
cout
}
}
The else {
If (d3 & gt; 1) {
cout
cout
}
Else if (d3==1) {
cout<" Shi "& lt; <" ";
If (d4 & gt; 0 {
cout
}
The else {
If (d4 & gt; 0 {
cout
}
}
}
}
}