• 水题 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
    ", s1[n]);
    17         else if (11 <= n && n <= 19)    printf ("%s
    ", 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 }
    编译人生,运行世界!
  • 相关阅读:
    LG3626 [APIO2009]会议中心(倍增+树状数组)
    LG3624 [APIO2008]DNA(DP+前缀和)
    CF1516C
    PKUSC2021 口胡题解
    THUSC2021 Day1口胡题解
    2021.4
    2021.3
    2021 暑假 sxyz 集训做题记录
    【做题记录】CF746F Music in Car
    KMP
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4544972.html
Copyright © 2020-2023  润新知