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. 网络端口(port)

    在同一个网络地址上,为了区分使用相同协议的不同应用程序,可以为不同的应用程序分配一个数字编号,称为端口号(port). 取值范围:0-65535 IANA(Internet Assigned Numb ...

  2. webstrom vue配置eslint

    (得出结论,还是得从官方文档中找,哇!!) 1.安装eslint插件,可以从search in repositories中获得,或者:http://plugins.jetbrains.com/plug ...

  3. nwjs问题总结

    1.iframe中不支持flash解决方法: nw初始化中加入代码: // 设置flashplayer在iframe中可用 chrome.contentSettings.plugins.set({ p ...

  4. UIView.animateWithDuration 没有动画过渡效果直接跳到最后

    当我在viewDidLoad()方法内添加以下代码的时候发现程序运行时不会有动画过度效果,而是直接跳到了最后. let x = (self.view.bounds.size.width - 268) ...

  5. python3:cmd运行python脚本,提示 No module named 'xxx'

    问题:cmd窗口运行python脚本,报错 C:\Users\xxx\Documents\GitHub\python3\main>python run_test.pyTraceback (mos ...

  6. 1.2.1 Elevator

    Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem De ...

  7. 玩转TypeScript(1) --定义简单的类

    相对于JavaScript来说,TypeScript增强了强制类型,同时添加了一系列的面向对象的特性,包含:静态类型(Static typing).类(Classes).接口(Interfaces). ...

  8. Windows自动执行java脚本

    1.打包 idea 1).File-Project Structure-Arifacts 2). 3). 4). 5). 目录位于  根目录/out\artifacts\ 2.Windows定时任务 ...

  9. HPU :字符串的统计

    字符串的统计 时间限制: 2 Sec 内存限制: 128 MB提交: 15 解决: 1 题目描述 给定n个字符串,我想知道第i个字符串已经出现多少次? 输入 第一行输入一个整数t,代表t(t < ...

  10. Python的学习之-计算机编码和二进制

    bit位,计算机中最小的表示单位 8bit = 1bytes字节,最小的储存单位,1bytes缩写为1b 1KB = 1024B 1MB = 1024KB 1GB = 1024MB 1TB = 102 ...