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

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

时间:2015-06-01 22:16:29      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

 

题目传送门

 1 /*
 2     很简单的水题,晚上累了,刷刷水题开心一下:)
 3 */
 4 #include <bits/stdc++.h>
 5 using namespace std;
 6 
 7 char s1[11][10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
 8 char s2[11][10] = {"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
 9 char s3[11][10] = {"ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
10 
11 int main(void)        //Codeforces Round #299 (Div. 2) A. Tavas and Nafas
12 {
13     int n;
14     while (scanf ("%d", &n) == 1)
15     {
16         if (n <= 9)    printf ("%s\n", s1[n]);
17         else if (11 <= n && n <= 19)    printf ("%s\n", s2[n-11]);
18         else
19         {
20             int x = n / 10;    int y = n % 10;
21             printf ("%s", s3[x-1]);
22             if (y)    printf ("-%s", s1[y]);
23             puts ("");
24         }
25     }
26 
27     return 0;
28 }

 

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

标签:

原文地址:http://www.cnblogs.com/Running-Time/p/4544972.html

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