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. flysql 里两种传参的方式

    传参的方式,两个标清楚: for lists_bx_goods in out_list: sql = XDO().get_update_sql('init_goods_test', { "一 ...

  2. 0.OpenCV框架

    reference: https://docs.opencv.org/4.1.2/ 基本使用 1.图片和视频,读写(2,8) 2.OpenCV基本数据类型(3) 3.OpenCV大型数据类型及操作:图 ...

  3. no sucn file or directory,scandir.......node-sass

    an 解决方法 运行 npm rebuild node-sass

  4. HP Loadrunner 12.53的下载与安装

    HP Loadrunner 12.53的下载与安装   HP Loadrunner 12.53的下载:http://pan.baidu.com/s/1c23axHm HP Loadrunner 12. ...

  5. Cocos2d-x之Action

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. 在Cocos2d-x中的Node对象可以有动作,特效和动画等动态特性.因此在Node类中定义了这些动态特性,因此精灵,标签,菜单,地图和粒 ...

  6. Java开发用H2数据库

    #JPA Configuration:#spring.jpa.database=MySQLspring.datasource.url=jdbc:h2:mem:jpaspring.datasource. ...

  7. rope(平衡二叉树)

    题目描述: 链接:https://www.nowcoder.com/acm/contest/141/C来源:牛客网 Eddy likes to play cards game since there ...

  8. 浏览器HTML自带懒加载技术

    对于目前的图片懒加载,我们一般采用的是通过第三方库或懒加载库来实现,但是该方式的显著问题就是,必须按顺序执行: 1.加载初始的 HTML 响应内容 2.加载懒加载库 3.加载图片 假如浏览器能直接支持 ...

  9. 403 ,502 到正确的nginx 配置

    配置完一定要reboot ,之前我一直用的 ./nginx -s reload ,这次我不知道为啥不行... 再没有reboot 之前一直在用的旧的配置.所以一直在报403forbbdin. rebo ...

  10. 使用python开启你的opencv之旅---图像的读入,存储

    python的便捷是如此的引人着迷,而opencv给python提供的接口使我们能够使用python来快速验证我们的想法,或者与别的模块快速结合,在这个系列文章我会通过jupyter notebook ...