tip:模拟(反正我没做出来 #include <iostream> #include <string> #include <vector> using namespace std; string num[10] = { "ling","yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu" }; string c[6] = { "Ge","Shi", "Bai", "Qian", "Yi", "Wan" }; int J...
"r",stdin);#endifstringunits[9]={""," Shi"," Bai"," Qian"," Wan"," Shi"," Bai"," Qian"," Yi"},nums[10]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"},number;cin>>number;if(number[0]=='-'){cout<<"Fu ";number=number.substr...
首先它是分字节来处理,这里的字节不是计算机中的byte,而是数字的字节,4位后是万,在4位是亿,然后从右到左每4个节处理一次,高位不足4位的就直接处理。 每个节内处理就是非零的数就读出相应的数字和位数,当做一个4位数字来读。 每读完4位数字要看这个数字是否大于5位,大于5位就最后还要读出相应的万或者亿。
usingnamespacestd; //key:每节每节地处理,在该节中遍历每位,如果当前位非首位且为0才令flag=true //如果当前位非0并且flag为true则要输出ling. //注意十百千 和 万亿 单位的输出 charnum[10][5]={//num[0]="ling" ,num[1]="yi"... "ling","yi","er","san","si","wu","liu","qi","...
1. 题目 Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For
importjava.io.*;publicclassMain{publicstaticvoidmain(String[]args)throwsIOException{String[]num={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};String[]pos={"Shi","Bai","Qian","Wan","Yi"};BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in));//读入一...
B1082 Read Number in Chinese (25分) Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi ...
1082 Read Number in Chinese (25 分) Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. OutputFufirst if it is negative. For example, -123456789 is read asFu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi jiu. ...
#include<iostream>#include<cstdio>#include<cstring>#include<iostream>#include<string.h>using namespace std;intmain(){intstart=0;bool istotoal=true;charw[][11]={"Yi","Qian","Bai","Shi","Wan","Qian","Bai","Shi",""};charn[][11]={"ling","yi","er","san","si","wu","liu...
简介:PAT (Advanced Level) Practice - 1082 Read Number in Chinese(25 分) 题目链接:点击打开链接 题目大意:智能读数。 解题思路: if 一位数: else: if 数位不为0: if 第一位为1,则shi开头而不是yi shi开头的情况。 else。 else: if 10亿 && 第二位为0。