Codeforces Round #299 (Div. 2) A. Tavas and Nafas-阿里云开发者社区

开发者社区> 云计算> 正文

Codeforces Round #299 (Div. 2) A. Tavas and Nafas

简介:

题目链接:http://codeforces.com/problemset/problem/535/A

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s1[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
    string s2[10]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
    string s3[10]={"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
    int m;
    while(cin>>m)
    {
        if(m<10)
            cout<<s1[m]<<endl;
        else if(m>=10 && m<20)
            cout<<s2[m%10]<<endl;
        else
        {
            if(m%10 != 0)
                cout<<s3[m/10-2]<<"-"<<s1[m%10]<<endl;
            else
                cout<<s3[m/10-2]<<endl;
        }

    }
    return 0;
}

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
云计算
使用钉钉扫一扫加入圈子
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

其他文章