codeforces 535A Tavas and Nafas

本文介绍了一个简单的程序,用于将整数分数转换为英文文字形式,特别适用于0到99之间的数字。程序通过逐位分析输入的整数,并将其转换为对应的英文单词。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

点击打开链接

A. Tavas and Nafas
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

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.

Examples
input
Copy
6
output
Copy
six
input
Copy
99
output
Copy
ninety-nine
input
Copy
20
output
Copy
twenty
Note

You can find all you need to know about English numerals in http://en.wikipedia.org/wiki/English_numerals .


水题,特别水,就是比较麻烦!其实完全可以写出所有情况

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
int main()
{
    // freopen("shuju.txt", "r", stdin);
    int n;
    cin >> n;
    if(n == 0)
        printf("zero\n");
    else if(n == 1)
        printf("one\n");
    else if(n == 2)
        printf("two\n");
    else if(n == 3)
        printf("three\n");
    else if(n == 4)
        printf("four\n");
    else if(n == 5)
        printf("five\n");
    else if(n == 6)
        printf("six\n");
    else if(n == 7)
        printf("seven\n");
    else if(n == 8)
        printf("eight\n");
    else if(n == 9)
        printf("nine\n");
    else if(n == 10)
        printf("ten\n");
    else if(n == 11)
        printf("eleven\n");
    else if(n == 12)
        printf("twelve\n");
    else if(n == 13)
        printf("thirteen\n");
    else if(n == 14)
        printf("fourteen\n");
    else if(n == 15)
        printf("fifteen\n");
    else if(n == 16)
        printf("sixteen\n");
    else if(n == 17)
        printf("seventeen\n");
    else if(n == 18)
        printf("eighteen\n");
    else if(n == 19)
        printf("nineteen\n");
    else if(n == 20)
        printf("twenty\n");
    else if(n == 30)
        printf("thirty\n");
    else if(n == 40)
        printf("forty\n");
    else if(n == 50)
        printf("fifty\n");
    else if(n == 60)
        printf("sixty\n");
    else if(n == 70)
        printf("seventy\n");
    else if(n == 80)
        printf("eighty\n");
    else if(n == 90)
        printf("ninety\n");
    else
    {
        int a = n / 10, b = n % 10;
        if(a == 2)
            printf("twenty-");
        else if(a == 3)
            printf("thirty-");
        else if(a == 4)
            printf("forty-");
        else if(a == 5)
            printf("fifty-");
        else if(a == 6)
            printf("sixty-");
        else if(a == 7)
            printf("seventy-");
        else if(a == 8)
            printf("eighty-");
        else if(a == 9)
            printf("ninety-");
        if(b == 1)
            printf("one\n");
        else if(b == 2)
            printf("two\n");
        else if(b == 3)
            printf("three\n");
        else if(b == 4)
            printf("four\n");
        else if(b == 5)
            printf("five\n");
        else if(b == 6)
            printf("six\n");
        else if(b == 7)
            printf("seven\n");
        else if(b == 8)
            printf("eight\n");
        else if(b == 9)
            printf("nine\n");
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值