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. React Native笔记整理

    判断一个APP页面时原生还是H5:http://www.cnblogs.com/sonice-cinsy/p/5671324.html 写给移动开发者的React Native指南:http://bl ...

  2. kbmMW CopyRawRecords 用法

    复制一个ClientQuery数据集到另外一个ClientQuery,我们应该怎么做?并注意什么呢? kbmMW为我们提供了好几个方法,有LoadFromDataSet,CopyRawRecords, ...

  3. nginx -s stop and -s quit 有什么区别?

    Quit is a graceful shutdown. Nginx finishes serving the open connections before shutdown Quit 是一个优雅的 ...

  4. ZOJ 2965 Accurately Say "CocaCola"!

    Time Limit: 2 Seconds      Memory Limit: 65536 KB In a party held by CocaCola company, several stude ...

  5. 30秒让让你的电脑快一倍 - 计算机基础 - 中国红客联盟 - Powered

    一.清理垃圾 在Windows在安装和使用过程中都会产生相当多的垃圾文件,包括临时文件(如:*.tmp.*._mp)日志文件(*.log).临时帮助文件(*.gid).磁盘检查文件(*.chk).临时 ...

  6. Unity 3D中 Ulua-UGUI简单的Demo——热更新的具体流程、使用说明

    Ulua热更新具体流程.使用说明 本文提供全流程,中文翻译.Chinar坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) 1 -- 未完 1 -- ...

  7. 隐藏微信小程序剪贴板提示

    wx.setClipboardData 剪贴内容老是有一个Toast提示,很不爽,如何隐藏? 只要你代码写得够快,提示都追不上你. wx.setClipboardData({ data: '女朋友了? ...

  8. MySQL Disk--SSD 特性

    ======================================================================= SSD 特性 .随机读能力非常好,连续读性能一般,但比普 ...

  9. leetcode:Symmetric Tree【Python版】

    #error caused by:#1:{} 没有考虑None输入#2:{1,2,2} 没有控制h和t#3:{4,-57,-57,#,67,67,#,#,-97,-97} 没有考虑负号,将s从str变 ...

  10. 测试开发系列之Python开发mock接口(一)

    什么是mock接口呢,举个栗子,你在一家电商公司,有查看商品.购物.支付.发 货.收获等等等一大堆功能,你是一个测试人员,测测测,测到支付功能的时候,你就要调用第三方支付接口了,真实支付,直接扣你支付 ...