Logo
(追記) (追記ここまで)

26568번 - ReWord-wrap 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB92261322.034%

문제

When a window of a text editor resizes, it is often necessary to readjust all of the containing words to fit in the screen window without splitting up any of the words. This is referred to as word-wrapping. Given a block of text, word-wrap the data to fit in a specific size.

입력

The first line of input will contain a single integer n that indicates the number of datasets to follow. Each dataset will consist of:

  • An integer w indicating the number of characters to word wrap, where 10 ≤ w ≤ 50.
  • An integer m indicating the number of lines of text input that are to be word wrapped, where 1 ≤ m ≤ 100.
  • The m lines of text to be word wrapped.

출력

Output the text word wrapped to the proper number of characters, and include one blank line after each dataset.

제한

예제 입력 1

2
40
4
Chinua Achebe was born on November 16, 1930 into the Igbo
African ethnic group in southern Nigeria. He was raised in a
Christian family, but he was always fascinated by the
traditional African religion and culture.
35
4
Achebe uses the short story of a hard working man
in a war torn area with a bright outlook on life to act
as a model for other Africans affected by
the Nigerian Civil War.

예제 출력 1

Chinua Achebe was born on November 16,
1930 into the Igbo African ethnic group
in southern Nigeria. He was raised in a
Christian family, but he was always
fascinated by the traditional African
religion and culture.
Achebe uses the short story of a
hard working man in a war torn area
with a bright outlook on life to
act as a model for other Africans
affected by the Nigerian Civil War.

힌트

출처

School > PLU High School Programming Contest > PLU 2019 > Advanced 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /