zoukankan      html  css  js  c++  java
  • HDU 1727 Hastiness(模拟)

    Hastiness

    Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 1793 Accepted Submission(s): 693

    Problem Description
    How many problems did you AC?
    When you read this problem, don’t hasty and careless, this is also simple, haha, I didn’t cheat you.
    The game over soon, WisKey starts using English begin countdown. He not only have no gene in math, but also bad in English. Fortunately, He met you who have gift in programming. So please help him to translate.

    Input
    Give you an integer T, output T in English, and note that all of words are lower case. (0<=T<=9999)

    Output
    One answer One line.
    Details see sample.

    Sample Input
    2034
    1234
    123
    24
    0
    
    
    Sample Output
    two thousand and thirty-four
    one thousand and two hundred and thirty-four
    one hundred and twenty-three
    twenty-four
    zero
    
    
    Author
    威士忌
    
    
    Source
    HZIEE 2007 Programming Contest
    

    模拟模拟,

    *#include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstring>
    using namespace std;
    int main()
    {
        char a[100][100];
        strcpy(a[0],"zero");
        strcpy(a[1],"one");
        strcpy(a[2],"two");
        strcpy(a[3],"three");
        strcpy(a[4],"four");
        strcpy(a[5],"five");
        strcpy(a[6],"six");
        strcpy(a[7],"seven");
        strcpy(a[8],"eight");
        strcpy(a[9],"nine");
        strcpy(a[10],"ten");
        strcpy(a[11],"eleven");
        strcpy(a[12],"twelve");
        strcpy(a[13],"thirteen");
        strcpy(a[14],"fourteen");
        strcpy(a[15],"fifteen");
        strcpy(a[16],"sixteen");
        strcpy(a[17],"seventeen");
        strcpy(a[18],"eighteen");
        strcpy(a[19],"nineteen");
        strcpy(a[20],"twenty");
        strcpy(a[30],"thirty");
        strcpy(a[40],"forty");
        strcpy(a[50],"fifty");
        strcpy(a[60],"sixty");
        strcpy(a[70],"seventy");
        strcpy(a[80],"eighty");
        strcpy(a[90],"ninety");
        int k,x,y,z,t;
        while(scanf("%d",&k)!=EOF)
        {
            if(k/1000!=0)
            {
                x=k/1000;
                printf("%s thousand",a[x]);
                y=k/100%10;
                if(y!=0)
                    printf(" and %s hundred",a[y]);
                z=k/10%10;
                t=k%10;
                if(z==0)
                {
                    if(t==0)
                        {printf("
    ");continue;}
                    printf(" and %s
    ",a[t]);
                    continue;
                }
                else if(z==1)
                {
                    z=k%100;
                    printf(" and %s
    ",a[z]);
                    continue;
                }
                else
                {
                     if(t==0)
                        {printf(" and %s
    ",a[k%100]);continue;}
                    printf(" and %s-%s
    ",a[z*10],a[t]);
                    continue;
                }
            }
            else if(k/100!=0)
            {
                y=k/100%10;
                if(y!=0)
                    printf("%s hundred",a[y]);
                z=k/10%10;
                t=k%10;
                if(z==0)
                {
                    if(t==0)
                        {printf("
    ");continue;}
                    printf(" and %s
    ",a[t]);
                    continue;
                }
                else if(z==1)
                {
                    z=k%100;
                    printf(" and %s
    ",a[z]);
                    continue;
                }
                else
                {
                    if(t==0)
                        {printf(" and %s
    ",a[k%100]);continue;}
                    printf(" and %s-%s
    ",a[z*10],a[t]);
                    continue;
                }
            }
            else if(k/10!=0)
            {
                z=k/10%10;
                t=k%10;
                if(z==0)
                {
                    if(t==0)
                        {printf("
    ");continue;}
                    printf("%s
    ",a[t]);
                    continue;
                }
                else if(z==1)
                {
                    z=k%100;
                    printf("%s
    ",a[z]);
                    continue;
                }
                else
                {
                    if(t==0)
                        {printf("%s
    ",a[k%100]);continue;}
                    printf("%s-%s
    ",a[z*10],a[t]);
                    continue;
                }
            }
            else
                printf("%s
    ",a[k]);
        }
        return 0;
    }
    
  • 相关阅读:
    Group_concat介绍与例子
    国家大学科技园名单
    shell截取第五行第三列
    (Deep) Neural Networks (Deep Learning) , NLP and Text Mining
    28款GitHub最流行的开源机器学习项目,推荐GitHub上10 个开源深度学习框架
    SpeeDO —— 并行深度学习系统
    BrandZ:2016年全球最具价值品牌百强榜(完整报告)
    jdk1.7升级到jdk1.8后出错: [ERROR] javadoc: warning
    伪基站收集方圆500至1000米范围内的手机卡信息,并且通过伪基站设备伪装成银行、中国移动、中国联通等任意号码向手机用户发送短信或拨打电话
    360手机助手内部资料曝光,63张PPT纯干货
  • 原文地址:https://www.cnblogs.com/nanfenggu/p/7899984.html
Copyright © 2011-2022 走看看