9-9-02. Write this number and write it in 9-9-02.
1002. Write this number (20) Time Limit 400 ms memory limit 65536 kB code length limit 8000 B discriminant program Standard author CHEN, Yue
Read a natural number n, calculate the sum of all its numbers, and write each digit in Chinese pinyin.
Input Format:Each test input contains one test case, that is, the value of natural number n. N must be less than 10100.
Output Format:Output each digit of n in a row. There is a space between the pinyin numbers, but there is no space after the last pinyin number in a row.
Input example:
1234567890987654321123456789
Output example:
yi san wu
# Include <stdio. h>
Int main ()
{
Char str [50];
Int arr [100], j = 0;
Int I, sum = 0, temp;
Gets (str );
For (I = 0; I <strlen (str); I ++)
{
Sum = sum + (str [I]-'0 ');
}
While (sum! = 0)
{
Temp = sum % 10;
Sum = sum/10;
Arr [j] = temp;
J ++;
}
For (I = J-1; I> 0; I --)
{
Switch (arr [I])
{
Case 1:
Printf ("yi"); break;
Case 2:
Printf ("er"); break;
Case 3:
Printf ("san"); break;
Case 4:
Printf ("si"); break;
Case 5:
Printf ("wu"); break;
Case 6:
Printf ("liu"); break;
Case 7:
Printf ("qi"); break;
Case 8:
Printf ("ba"); break;
Case 9:
Printf ("jiu"); break;
Case 0:
Printf ("ling"); break;
}
}
Switch (arr [0])
{
Case 1:
Printf ("yi"); break;
Case 2:
Printf ("er"); break;
Case 3:
Printf ("san"); break;
Case 4:
Printf ("si"); break;
Case 5:
Printf ("wu"); break;
Case 6:
Printf ("liu"); break;
Case 7:
Printf ("qi"); break;
Case 8:
Printf ("ba"); break;
Case 9:
Printf ("jiu"); break;
Case 0:
Printf ("ling"); break;
}
Return 0;
}