CF Tavas and Nafas
2015-04-16 23:56
302 查看
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.
Sample test(s)
input
output
input
output
input
output
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.
Sample test(s)
input
6
output
six
input
99
output
ninety-nine
input
20
output
twenty 英语基础题
#include <iostream> #include <cmath> #include <cstring> #include <cstdio> #include <string> #include <algorithm> #include <cctype> #include <queue> #include <map> using namespace std; char HIGH[][20] = {"ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"}; char TEN[][20] = {"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen", "seventeen","eighteen","nineteen"}; char LOW[][20] = {"zero","one","two","three","four","five","six","seven","eight", "nine"}; int main(void) { string s; int len; while(cin >> s) { len = s.size(); if(len == 1) cout << LOW[s[0] - '0'] << endl; else if(s[0] == '1') cout << TEN[s[1] - '0'] << endl; else { if(s[1] == '0') cout << HIGH[s[0] - '1'] << endl; else cout << HIGH[s[0] - '1'] << '-' << LOW[s[1] - '0'] << endl; } } return 0; }
相关文章推荐
- CF Tavas and Karafs (二分)
- codeforces535A:Tavas and Nafas
- Codeforces Round #299 (Div. 2)A. Tavas and Nafas
- 535A: Tavas and Nafas
- A. Tavas and Nafas
- cf. Tavas and SaDDas
- 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas
- codeforces535D:Tavas and Nafas
- Codeforces Round #299 (Div. 2) A. Tavas and Nafas 水题
- CF 299 div2 D. Tavas and Malekas(KMP)
- Codeforces Round #299 (Div. 2) A. Tavas and Nafas
- 【Cf #299 C】Tavas and Pashmaks(单调栈,凸性)
- #299 (div.2) A. Tavas and Nafas
- 【Codeforces Round #299 (Div. 2) A】 Tavas and Nafas
- Code Forces 535 A. Tavas and Nafas(水~)
- DFS Codeforces Round #299 (Div. 2) B. Tavas and SaDDas
- [CF] 950A Left-handers, Right-handers and Ambidexters
- CF 369E - Valera and Queries(树状数组)
- cf B. Sereja and Suffixes
- Bear and Blocks CF-574D(类似dp+思维)