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;
}

你可能感兴趣的:(水)