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 Fufirst 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

分析: 这个题有点复杂。。慢慢模拟。。debug了好久,要注意一个数中间空了多个零,只要输出一个零。。。

一开始没注意,女朋友随便给我出了个数。。竟然真错在这里了,她是不是有干测试的潜质= =

 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-24-22.11.37
 * Description : A1082
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;
 ]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
 ]={"Yi","Wan"};

 void func(int n){
     string s=to_string(n);
     ){
         cout<<num[s[]-'];
     }
     ){
         cout<<num[s[]-']<<" "<<"Shi";
         ]!='){
             cout<<]-'];
         }
     }
     ){
         cout<<num[s[]-']<<" "<<"Bai";
         ]=='){
             ]!='){
                 cout<<]-'];
             }
         }
         else{
             cout<<]-']<<" Shi";
             ]!='){
                 cout<<]-'];
             }
         }
     }
     ){
         cout<<num[s[]-']<<" Qian";
         ]=='){
             ]=='){
                 ]!='){
                     cout<<]-'];
                 }
             }
             else{
                 cout<<]-']<<" Shi";
                 ]!='){
                     cout<<]-'];
                 }
             }
         }
         else{
             cout<<]-']<<" Bai";
             ]=='){
                 ]!='){
                     cout<<]-'];
                 }
             }
             else{
                 cout<<]-']<<" Shi";
                 ]!='){
                     cout<<]-'];
                 }
             }
         }
     }
 }

 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     int s;
     cin>>s;
     ){
         printf("ling");
         ;
     }
     ){
         printf("Fu ");
         s=-s;
     }
     ;
     /;
     ;
     bool flag=false;
     if(s1){
         func(s1);
         cout<<]<<" ";
     }
     if(s2){
         string t2=to_string(s2);
         ){
             ;i<=t2.size();i++){
                 '){
                     cout<<"ling ";
                 }
             }
         }
         func(s2);
         cout<<]<<" ";
     }
     if(s3){
          && s2==){
             cout<<"ling ";
             flag=true;
         }
         string t3=to_string(s3);
         ){
             ;i<=t3.size();i++){
                 ' && flag==false){
                     cout<<"ling ";
                     flag=true;
                 }
             }
         }
         func(s3);
     }
     ;
 }
 

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

  1. 1082 Read Number in Chinese (25分)

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

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

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

  3. A1082 Read Number in Chinese (25 分)

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

  4. 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 ...

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

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

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

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

  7. pat1082. Read Number in Chinese (25)

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

  8. 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 ...

  9. PAT 1082 Read Number in Chinese[难]

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

随机推荐

  1. DevExpress WPF入门指南:跟随 Items Source 向导完成数据绑定

    Items Source Wizard Items Source Configuration Wizard允许在设计时执行数据绑定.跟随这个向导可以自动生成XAML数据绑定代码. 下面就来展示下如何使 ...

  2. Alpha阶段敏捷冲刺---Day6

    一.Daily Scrum Meeting照片 二.今天冲刺情况反馈 今天的任务标志着我们项目进入收尾阶段,今天将完成大部分程序的功能,例如主界面设计,彻底完成计算模块,服务器随机生成题目等等,这些任 ...

  3. 微信小程序代码片段

    微信小程序代码片段是一种可分享的小项目,可用于分享小程序和小游戏的开发经验.展示组件和 API 的使用.复现开发问题等等.分享代码片段会得到一个链接,所有拥有此分享链接的人可以在工具中导入此代码片段. ...

  4. linux C/C++服务器后台开发面试题总结

    一.编程语言 1.根据熟悉的语言,谈谈两种语言的区别? 主要浅谈下C/C++和PHP语言的区别: 1)PHP弱类型语言,一种脚本语言,对数据的类型不要求过多,较多的应用于Web应用开发,现在好多互联网 ...

  5. CentOS7安装OpenStack(Rocky版)-03.安装Glance镜像服务组件(控制节点)

    上篇文章分享了keystone的安装配置,本文接着分享openstack的镜像服务glance. --------------- 完美的分割线 ---------------- 3.0.glance概 ...

  6. win+linux双系统安装笔记

    1.出现win与linux只能引导之一启动,此时启动linux并更改启动文件可以用linux自带的grub2引导启动 2.ubuntu64位安装时需要联网,因为其有bug,镜像文件中缺少gurb2,需 ...

  7. 【计算机视觉】如何使用于仕琪老师的libfacedetect人脸检测库

    前言 最近又开始进行人脸检测方向的内容,看到于仕琪老师的多角度检测想试一下,还不清楚原理,先测试效果如何. libfacedetect人脸检测库是深圳大学于仕琪老师发布的开源库,与opencv自带的人 ...

  8. [LeetCode&Python] Problem 561. Array Partition I

    Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1 ...

  9. Vue2.x directive自定义指令

    directive自定义指令 除了默认设置的核心指令( v-model 和 v-show ),Vue 也允许注册自定义指令. 注意,在 Vue2.0 里面,代码复用的主要形式和抽象是组件——然而,有的 ...

  10. postman环境变量的设置

    相同的api接口因为部署环境不同,分为test和fromal 不仅重复,还容易出错 下面来介绍一下Postman的一个小技巧来解决这种问题: 设置环境变量 Tips: 不是在OS中设置环境变量哦   ...