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

 

题目传送门

 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)