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

J3. Cold Compress

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

의견: 0

설명

Your new cellphone plan charges you for every character you send from
your phone. Since you tend to send sequences of symbols in your
messages, you have come up with the following compression technique: for
each symbol, write down the number of times it appears consecutively,
followed by the symbol itself. This compression technique is called
run-length encoding.

More formally, a block is a substring of identical symbols that is as
long as possible. A block will be represented in compressed form as the
length of the block followed by the symbol in that block. The encoding
of a string is the representation of each block in the string in the
order in which they appear in the string.

Given a sequence of characters, write a program to encode them in
this format.

제약
입력 형식

The first line of input contains the number \(N\), which is the number of lines that
follow. The next \(N\) lines will
contain at least one and at most 80 characters, none of which are
spaces.

출력 형식

Output will be \(N\) lines. Line \(i\) of the output will be the encoding of
the line \(i+1\) of the input. The
encoding of a line will be a sequence of pairs, separated by a space,
where each pair is an integer (representing the number of times the
character appears consecutively) followed by a space, followed by the
character.

예제 1
입력
4
+++===!!!!
777777......TTTTTTTTTTTT
(AABBC)
3.1415555
출력
3 + 3 = 4 !
6 7 6 . 12 T
1 ( 2 A 2 B 1 C 1 )
1 3 1 . 1 1 1 4 1 1 4 5
설명

To see how the first message (on the second line of input) is encoded,
notice that there are 3 + symbols, followed by
3 = symbols, followed by 4
! symbols.

문제 정보

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

출처 CCC 2019 Junior

평가 및 의견

J3. Cold Compress

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

Log in to rate problems.

개별 의견

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

풀이 제출

J3. Cold Compress

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