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","six","seven","eight","nine"};
    string s2[10]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
    string s3[10]={"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
    int m;
    while(cin>>m)
    {
        if(m<10)
            cout<<s1[m]<<endl;
        else if(m>=10 && m<20)
            cout<<s2[m%10]<<endl;
        else
        {
            if(m%10 != 0)
                cout<<s3[m/10-2]<<"-"<<s1[m%10]<<endl;
            else
                cout<<s3[m/10-2]<<endl;
        }

    }
    return 0;
}
时间: 2024-10-01 07:04:05

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

水题 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

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 #299 (Div. 1)C. Tavas and Pashmaks (凸壳)

C. Tavas and Pashmaks Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S 

Codeforces Round #299 (Div. 2)D. Tavas and Malekas

KMP,先预处理按每个节点标记,扫一遍更新每个匹配位置,最后kmp判断是否有重合而且不相同的地方 注意处理细节,很容易runtime error #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #inclu

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

英语渣渣感觉无力...翻了下题解才知道题意... 给你一个无限长的等差数列a,n个查询.对于每个查询,给出l,t,m,求最大的r.表示在等差数列a的第l号元素到第r号元素,执行t次操作,对于每一次操作,在[l,r]区间内选出m个数,并且把这m个数-1,执行完t次操作后,使得区间[l,r]内的数全部为0,求区间最大的右端点r. 如果t小于a[l],那么执行完t次操作a[l]也不会为0,输出-1 那么同理我们可以求出r的范围,r肯定小于等于(t-a)/b,因为数列是递增的. 既然我们都已经知道了范围

#299 (div.2) A. Tavas and Nafas

1.题目描述:点击打开链接 2.解题思路:本题是一道简单的模拟题,要求将小于100的每个数的英文单词输出,提前打表即可.注意0,11~19要特殊处理. 3.代码: #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<string> #include<sstream> #include<set> #include<vector>

Codeforces Round #279 (Div. 2) ABCD

Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard input/

Codeforces Round #428 (Div. 2)

Codeforces Round #428 (Div. 2) A    看懂题目意思就知道做了 #include<bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") #define rep(i,a,b) for (int i=a; i<=b; ++i) #define per(i,b,a) for (int i=b; i>=a; --i