码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-06-24 16:34:49      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

题目链接: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;
}

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

标签:

原文地址:http://blog.csdn.net/qingshui23/article/details/46621893

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!