水题 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 }
时间: 2024-10-23 15:50:50

水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas的相关文章

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

题目链接:http://codeforces.com/problemset/problem/535/A #include <iostream> #include <string> using namespace std; int main() { string s1[10]={"zero","one","two","three","four","five",&qu

水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta&#39;s Gift

题目传送门 1 /* 2 水题:vector容器实现插入操作,暴力进行判断是否为回文串 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <cstring> 8 #include <string> 9 #include <vector> 10 using namespace std; 11 12 const int MAXN

DFS Codeforces Round #299 (Div. 2) C. Tavas and Karafs

题目传送门 1 /* 2 DFS:按照长度来DFS,最后排序 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <iostream> 8 #include <cmath> 9 #include <vector> 10 using namespace std; 11 12 const int MAXN = 1e3 + 10; 1

二分搜索 Codeforces Round #299 (Div. 2) C. Tavas and Karafs

题目传送门 1 /* 2 题意:给定一个数列,求最大的r使得[l,r]的数字能在t次全变为0,每一次可以在m的长度内减1 3 二分搜索:搜索r,求出sum <= t * m的最大的r 4 详细解释:http://blog.csdn.net/libin56842/article/details/45082747 5 */ 6 #include <cstdio> 7 #include <algorithm> 8 #include <cstring> 9 #includ

水题 Codeforces Round #303 (Div. 2) A. Toy Cars

题目传送门 1 /* 2 题意:5种情况对应对应第i或j辆车翻了没 3 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 4 3: if both cars turned over during the collision. 5 是指i,j两辆车,而不是全部 6 */ 7 #include <cstdio> 8 #include <algorithm> 9 #include <cstring> 10 #include <cmath> 11 #

水题 Codeforces Round #302 (Div. 2) A Set of Strings

题目传送门 1 /* 2 题意:一个字符串分割成k段,每段开头字母不相同 3 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 4 */ 5 #include <cstdio> 6 #include <iostream> 7 #include <cstring> 8 #include <string> 9 #include <algorithm> 10 using namespace std; 11 12 con

水题 Codeforces Round #308 (Div. 2) A. Vanya and Table

题目传送门 1 /* 2 水题:读懂题目就能做 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <cstring> 8 #include <cmath> 9 #include <vector> 10 #include <string> 11 #include <queue> 12 #include

水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas

题目传送门 1 /* 2 水题:ans = (1+2+3+...+n) * k - n,开long long 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <cmath> 8 using namespace std; 9 10 typedef long long ll; 11 12 int main(void) //Codeforces Roun

水题 Codeforces Round #303 (Div. 2) D. Queue

题目传送门 1 /* 2 比C还水... 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <cmath> 8 #include <iostream> 9 using namespace std; 10 11 typedef long long ll; 12 13 const int MAXN = 1e5 + 10; 14 const i