RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00288

Rečenice

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Once upon a time in a land far far away, inhabited only by math students, Iva and Vedran were
discussing self-explanatory sentences. A part of these sentences is exactly one number and it is equal
to the total number of letters in the sentence. Some examples are: “This sentence has thirtyone
letters.”, “Blah blah seventeen”.

Little Jurica overheard his friends' conversation and decided to impress them with the amount of self-
explanatory sentences he knows by heart. He rushed back home and wrote a programme which will,
given a sentence, tell him the minimum number he can put inside so that the sentence is valid.
Unfortunately, his computer broke and now he needs your help. Write a programme to help Jurica!

The form of the sentence is: word1 word2 word3 ... \( word_n-1\ word_n. The\ character \) represents the
place where the number should be put in.
For example, the form of the sentence “this sentence has thirtyone letters” would be “this sentence has
$ letters”.

The rules that apply to writing numbers are the following:
• numbers from 1 to 10 are written “one”, “two”, “three”, “four”, “five”, “six”, “seven”, “eight”,
“nine”, “ten”, respectively
• numbers from 11 to 19 are written “eleven”, “twelve”, “thirteen”, “fourteen”, “fifteen”,
“sixteen”, “seventeen”, “eighteen”, “nineteen”
• the remaining double digit numbers are written in a way that we name the tens' digit and add to
it the name of the one digit remaining when we remove the tens' digit. Specially, if by removing
the tens' digit we remain with zero, we add nothing to it
• the tens' digits (respectively from 2 to 9) are named the following: “twenty”, “thirty”, “forty”,
“fifty”, “sixty”, “seventy”, “eighty”, “ninety”
• three digit numbers are written in a way that we name the hundreds' digit number and add to it
the number of the double digit number remaining. Specially, if by removing the hundreds' digit
we remain with zero, we add nothing to it
• the hundreds' digits (respectively from 1 to 9) are named the following: “onehundred”,
“twohundred”,
“threehundred”,
“fourhundred”,
“fivehundred”,
“sixhundred”,
“sevenhundred”, “eighthundred”, “ninehundred”
• the rules that apply for numbers with more than three digits are not relevant because the input
data will always be such that the output is less than a thousand

Examples of naming some numbers:
• 68 = “sixty” + “eight” = “sixtyeight”
• 319 = “threehundred” + “nineteen” = “threehundrednineteen”
• 530 = “fivehundred” + “thirty” = “fivehundredthirty”
• 971 = “ninehundred” + “seventy” + “one” = “ninehundredseventyone”

제약

In test cases worth 40% of total points, the required number for the sentence will be less or equal to 50.

입력 형식

The first line of input contains the integer N (1 ≤ N ≤ 20), the number of words in the sentence.
Each of the following N lines contains a word not longer than 50 lowercase letters of the English
alphabet or the character $ (none of the words will be the name of a number).
The character $ will appear exactly once.

출력 형식

The first and only line of output must contain the required sentence.
The numbers are named as mentioned before, even if the sentence sounds gramatically incorrect.
The input data will be such that a solution will always exist and is less than 1000.

예제 1
입력
5
this
sentence
has
$
letters
출력
this sentence has
thirtyone letters
예제 2
입력
7
$
is
the
number
of
letters
here
출력
thirty is the number
of letters here
예제 3
입력
5
the
letters
are
$
potato
출력
the
letters
are
twentynine
potato
설명

Clarification of the second example: Sentence is split in two lines because of the lack of space in the
table. The total number of letters in the sentence is 6 + 2 + 3 + 6 + 2 + 7 + 4 = 30
Clarification of the third example: As you can see, this sentence is gramatically incorrect.
Nevertheless, Jurica is not concerned by that, for he is a mathematician, not a linguist.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2013/2014 Contest 3

평가 및 의견

Rečenice

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Rečenice

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8