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. 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 jiu. Note: zero (ling) must be handled correctly according to the Chinese tradition. For example, 100800 is yi Shi Wan ling ba Bai.

Input Specification:

Each input file contains one test case, which gives an integer with no more than 9 digits.

Output Specification:

For each test case, print in a line the Chinese way of reading the number. The characters are separated by a space and there must be no extra space at the end of the line.

Sample Input 1:

-123456789

Sample Output 1:

Fu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi jiu

Sample Input 2:

100800

Sample Output 2:

yi Shi Wan ling ba Bai

 #include<bits/stdc++.h>
using namespace std; string Week[]={
"MON","TUE","WED","THU","FRI","SAT","SUN"
}; string num[]={
"ling","yi","er","san","si","wu","liu","qi","ba","jiu"
}; string wei[]={
"Shi","Bai","Qian","Wan","Yi"
}; int main(){ string str; cin>>str; int len=str.size(); int left=,right=len-; if(str[]=='-')
{
left++;
cout<<"Fu";
} while(left+<=right) //注意等于号
right-=; while(left<len){ bool flag=false;
bool isPrint=false; while(left<=right){ if(left>&&str[left]==''){
flag=true;
}else{
if(flag){
cout<<" ling";
flag=false;
}
isPrint=true; if(left>)cout<<" "; //注意格式空格
cout<<num[str[left]-'']; if(left!=right)
cout<<" "<<wei[right-left-]; } left++;
} if(isPrint==true&&right!=len-){
cout<<" "<<wei[(len--right)/+];
} right+=; } return ;
}


A1082 Read Number in Chinese (25 分)的更多相关文章

  1. A1082 Read Number in Chinese (25)(25 分)

    A1082 Read Number in Chinese (25)(25 分) Given an integer with no more than 9 digits, you are suppose ...

  2. 【PAT甲级】1082 Read Number in Chinese (25 分)

    题意: 输入一个九位整数,输出它的汉字读法(用拼音表示). trick: 字符串数组""其实会输出一个空格,而不是什么都不输出,导致测试点0和4格式错误. AAAAAccepted ...

  3. 1082 Read Number in Chinese (25分)

    // 1082.cpp : 定义控制台应用程序的入口点. // #include <iostream> #include <string> #include <vecto ...

  4. pat1082. Read Number in Chinese (25)

    1082. Read Number in Chinese (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  5. A1082. Read Number in Chinese

    Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese ...

  6. 1082. Read Number in Chinese (25)

    题目如下: Given an integer with no more than 9 digits, you are supposed to read it in the traditional Ch ...

  7. PAT甲级——A1082 Read Number in Chinese

    Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese ...

  8. 1082. Read Number in Chinese (25)-字符串处理

    题意就是给出9位以内的数字,按照汉子的读法读出来. 读法请看下方的几个例子: 5 0505 0505 伍亿零伍佰零伍万零伍佰零伍 5 5050 5050 伍亿伍仟零伍拾万伍仟零伍拾  (原本我以为这个 ...

  9. PAT (Advanced Level) 1082. Read Number in Chinese (25)

    模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

随机推荐

  1. VB - sendKey

    Set WshShell=WScript.CreateObject("WScript.Shell") WshShell = SendKeys string “string”:表示要 ...

  2. html5 新增元素以及css3新特性

    HTML5 1.HTML5 新元素 HTML5提供了新的元素来创建更好的页面结构: 标签 描述 <article> 定义页面独立的内容区域. <aside> 定义页面的侧边栏内 ...

  3. 在虚拟机的Linux系统下安装wineqq

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. 本文参考教程:http://www.ubuntukylin.com/ukylin/forum.php?mod=viewthread& ...

  4. gitlab fatal: Authentication failed for 'http://10.2.80.17:8090/yeyichao/201904041026PROj.git/'

    fatal: Authentication failed for 'http://10.2.80.17:8090/yeyichao/201904041026PROj.git/' git config ...

  5. if语句基本练习需求

    1.需求:键盘录入一个成绩,判断并输出成绩的等级. 90-100 优 80-89 良好 70-79 中等 60-69 及格 0-59 不及格 import java.util.Scanner; cla ...

  6. shell中#*,##*,#*,##*,% *,%% *的含义及用法

    介绍下Shell中的${}.##和%%使用范例,本文给出了不同情况下得到的结果.假设定义了一个变量为:代码如下:file=/dir1/dir2/dir3/my.file.txt可以用${ }分别替换得 ...

  7. WebAPI 生成验证码

    private HttpResponseMessage CreateCheckCodeImage(string checkCode) { HttpResponseMessage result = ne ...

  8. eclipse导入了jar查看不了源码解决方法

    当导入源码的时候ctrl+左键的时候,还是查看不了源码.问题一直困扰我很久,百度了很多方法.现在分享下解决的方法. 经过简单整理,如下: 第一步:下载JAD . jad官方地址的官方下载地址是: ht ...

  9. go语言从例子开始之Example5.for循环

    for 是 Go 中唯一的循环结构.这里有 for 循环的三个基本使用方式. package main import "fmt" func main() { 最常用的方式,带单个循 ...

  10. (原)centos 防火墙开放端口命令

    centos 防火墙默认是关闭非系统端口的,所以用到非系统端口首先开放,命令如下 firewall-cmd --zone=public --add-port=1935/tcp --permanent ...