每日一题D 2015-6-1 17:34
2015-06-01 17:33
423 查看
这个题怎么说呢,太简单了,实在没什么好说的!#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d", &n);
char* a[30] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char* b[15] = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
if( n < 20)
printf("%s\n", a
);
else
{
if(n % 10 == 0)
printf("%s\n",b[(n/10) - 2]);
else
printf("%s-%s\n",b[(n/10) - 2], a[n%10]);
}
return 0;
}
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.
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
Input
6
Output
six
Input
99
Output
ninety-nine
Input
20
Output
twenty
Hint
You can find all you need to know about English numerals in http://en.wikipedia.org/wiki/English_numerals .
相关文章推荐
- 百度之星2015初赛第一场
- GoogleCodeJam2015第二轮
- Go的pprof使用
- 基于PHP的cURL快速入门教程 (小偷采集程序)
- ubuntu下配置Apache
- JS对象基础
- 学习SpringMVC系列教程(三)Controller接口控制器详解
- 猜数字游戏(jackpot)
- 图片的模糊处理
- Redmine与Zentao同机快速部署指南
- 架构设计三部曲之如何写架构设计说明书
- 让UILabel顶部对齐
- 第13周 读代码答题-2
- linq to DataTable 排序
- Golang Channel用法简编
- 两台电脑如何实现共享文件
- 变量、作用域和内存问题 - 基本类型和用类型的值
- CSS3 transition transform
- 如何跨越SAT阅读词汇的障碍
- STDIN_FILENO与STDIN的区别