zoukankan      html  css  js  c++  java
  • Codeforces Round #299 (Div. 2) A. Tavas and Nafas 水题

    A. Tavas and Nafas

    Time Limit: 1 Sec  Memory Limit: 256 MB

    题目连接

    http://codeforces.com/contest/535/problem/A

    Description

    Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.

    His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.

    He ate coffee mix without water again, so right now he's really messed up and can't think.

    Your task is to help him by telling him what to type.

    Input

    The first and only line of input contains an integer s (0 ≤ s ≤ 99), Tavas's score.
    1000000000.

    Output

    In the first and only line of output, print a single string consisting only from English lowercase letters and hyphens ('-'). Do not use spaces.

    Sample Input

    6

    Sample Output

    six

    HINT


    题意

    给你100以下数字,输出英文

    题解:

    沙比提

    代码:

    //qscqesze
    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <set>
    #include <vector>
    #include <sstream>
    #include <queue>
    #include <typeinfo>
    #include <fstream>
    #include <map>
    #include <stack>
    typedef long long ll;
    using namespace std;
    //freopen("D.in","r",stdin);
    //freopen("D.out","w",stdout);
    #define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
    #define maxn 200001
    #define mod 10007
    #define eps 1e-9
    //const int inf=0x7fffffff;   //无限大
    const int inf=0x3f3f3f3f;
    /*
    
    int buf[10];
    inline void write(int i) {
      int p = 0;if(i == 0) p++;
      else while(i) {buf[p++] = i % 10;i /= 10;}
      for(int j = p-1; j >=0; j--) putchar('0' + buf[j]);
      printf("
    ");
    }
    */
    //**************************************************************************************
    inline ll read()
    {
        int x=0,f=1;char ch=getchar();
        while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
        while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
        return x*f;
    }
    map<int,string> s;
    
    
    
    int main()
    {
        int n=read();
        s[1]="one";
        s[2]="two";
        s[3]="three";
        s[4]="four";
        s[5]="five";
        s[6]="six";
        s[7]="seven";
        s[8]="eight";
        s[9]="nine";
        s[10]="ten";
        s[11]="eleven";
        s[12]="twelve";
        s[13]="thirteen";
        s[14]="fourteen";
        s[15]="fifteen";
        s[16]="sixteen";
        s[17]="seventeen";
        s[18]="eighteen";
        s[19]="nineteen";
        s[20]="twenty";
        s[30]="thirty";
        s[40]="forty";
        s[50]="fifty";
        s[60]="sixty";
        s[70]="seventy";
        s[80]="eighty";
        s[90]="ninety";
        if(n==0)
            cout<<"zero"<<endl;
        else if(n<=20)
            cout<<s[n]<<endl;
        else if(n%10==0)
            cout<<s[n]<<endl;
        else 
            cout<<s[n-n%10]<<"-"<<s[n%10]<<endl;
    }
  • 相关阅读:
    Python基础课:多继承
    Python基础课:定义一个函数,输入一个序列,判断序列是顺序还是逆序,顺序输出UP,逆序输出DOWN,否则输出None
    Python基础课:测试type 和 isinstance 那个的速度更快
    Python基础课:定义一个函数,可以对序列逆序的输出(对于列表和元组可以不用考虑嵌套的情况)
    WEBAPI获取数据
    jQuery中的.height()、.innerHeight()和.outerHeight()
    Javascript基类对象原型中有数组的情况
    必须关注的25位知名JavaScript开发者
    jQuery中的事件绑定函数.bind()、.live()、on()和.delegate()
    Javascript全局变量和delete
  • 原文地址:https://www.cnblogs.com/qscqesze/p/4427462.html
Copyright © 2011-2022 走看看