A1082 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 分)的更多相关文章
- 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 ...
- 【PAT甲级】1082 Read Number in Chinese (25 分)
题意: 输入一个九位整数,输出它的汉字读法(用拼音表示). trick: 字符串数组""其实会输出一个空格,而不是什么都不输出,导致测试点0和4格式错误. AAAAAccepted ...
- 1082 Read Number in Chinese (25分)
// 1082.cpp : 定义控制台应用程序的入口点. // #include <iostream> #include <string> #include <vecto ...
- pat1082. Read Number in Chinese (25)
1082. Read Number in Chinese (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- A1082. Read Number in Chinese
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese ...
- 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 ...
- 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 ...
- 1082. Read Number in Chinese (25)-字符串处理
题意就是给出9位以内的数字,按照汉子的读法读出来. 读法请看下方的几个例子: 5 0505 0505 伍亿零伍佰零伍万零伍佰零伍 5 5050 5050 伍亿伍仟零伍拾万伍仟零伍拾 (原本我以为这个 ...
- PAT (Advanced Level) 1082. Read Number in Chinese (25)
模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
随机推荐
- UITableView 支持左右滑动(一)
原理如下: SwipeTableView subView 1 : UIScrollView作为容器, 主要负责左右滑动, 每个tableView的顶部设置相同的contentInset subVie ...
- jmeter_使用命令行运行
使用非GUI模式,即命令行模式运行 JMeter 测试脚本能够大大缩减所需要的系统资源. Windows下以命令行模式运行的方法: 1.命令介绍 jmeter -n -t <testfile f ...
- Linux下实现MySQL数据库每天定时自动备份
使用MySQL自带的备份工具+ crontab 的方式来实现备份 1.查看磁盘挂载信息(选一个容量合适的) #df -h 2.创建备份目录 为了方便,在/home保存备份文件: cd /home/ga ...
- 【计算机网络】两个网络模型——OSI参考模型和TCP/IP模型
计算机网络 两个网络模型 计算机网络模型 分层机制----规划通讯细节 层与层之间之间是独立的.屏蔽的,下层为上层提供服务. 一些概念 实体: 任何发送/接收信息的软件/硬件进程. 对等层: 两个不同 ...
- .NET/VB.NET: solving the error “The system cannot find the file specified.” “\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.vb”
Source Link Bumped into this error a while ago in Visual Studio 2010: Kind Error Number 80 Descripti ...
- Spring clound 微服务--理解篇
定义:微服务就是一些协调工作的小而自治的服务 优点: 异构性:不同微服务可以使用不同的语言实现, 后端数据库也可以根据自身业务定义服务. 弹性: 一个组件不可用,不会导致级联故障.一个系统出了问题,不 ...
- flink批处理中的source以及sink介绍
一.flink在批处理中常见的source flink在批处理中常见的source主要有两大类: 1.基于本地集合的source(Collection-based-source) 2.基于文件的sou ...
- easyUI学习笔记二
1. 拖拉大小 <!DOCTYPE html> <html> <head> <title>easyui学习</title> <scr ...
- 【ARC076F】 Exhausted
hall定理大概是匈牙利的理论基础吧 hall定理的内容:二分图\(G\)的的左部点点集为\(\rm X\),右部点点集为\(\rm Y\),设\(|\rm X|\leq |Y|\),则二分图\(G\ ...
- 编译Linux-2.6.23内核中遇见的错误
编译linux-2.6.23 错误[1]: elf_x86_64: 没有那个文件或目录 原因是 gcc 4.6 不再支持 linker-style 架构.在 arch/x86/vdso/Makefil ...