Topic content:
Your program is going to read an integer in the range [ -100000,100000]. Then, use Hanyu Pinyin to output each bit of this integer.
If you enter 1234, the output:
Yi er san si
Note that there is a space between the pinyin for each word, but there is no space behind the last word. When a negative number is encountered, add "fu" at the beginning of the output, such as the 2341 output as:
Fu er san si yi
Input format:
An integer that ranges from [ -100000,100000].
Output format:
The pinyin that represents each digit of the integer, with a space separating the pinyin for each digit, and no space at the end.
Input Sample:
-30
Sample output:
Fu San Ling
Time limit: 500ms memory limit: 32000kb
main.c//c yuyan////Created by Anzhongyin on 2016/11/29.//Copyright? 2016 Anzhongyin. All rights reserved.//#include <stdio.h> #include <math.h>int main (int argc, const char * argv[]) {//Inser T code here ... int i; scanf ("%d", &i); int n=0; if (i<0) {printf ("fu"); I=i*-1; } int m=i; while (m>0) {M=M/10; n++; } if (i==0) {printf ("ling\n"); } for (int j=n-1;j>=0;j--) {int b=i/(POW (10,j)); i=i% (int) pow (10,j); Switch (b) {case 0:printf ("Ling"); Break 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 } if (j!=0) {printf (""); } else {printf ("\ n"); } } }
Use case test Results |
Run time |
Memory consumption |
Tips |
Score |
Use Case 1 by |
1ms |
256kb |
|
1 |
Use Case 2 by |
1ms |
128kb |
|
1 |
Use Case 3 by |
1ms |
256kb |
|
1 |
Use Case 4 by |
1ms |
256kb |
|
1 |
Use Case 5 by |
1ms |
128kb |
|
1 |
Submit an Answer
Score/Score:5.00/5.00 min
Introduction to Programming--c Language 4th week programming exercises 2 read integers (5 points)