## CCC '09 J4 - Signage

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 64M

Problem type
##### Canadian Computing Competition: 2009 Stage 1, Junior #4

The student council at Central Canada Collegiate is preparing signs with the message WELCOME TO CCC GOOD LUCK TODAY on various walls around the school. A sign is wide enough to hold characters on each row, including spaces, as befits the wall to be decorated.

Here is how the words are put onto a sign. First, as many words as possible are placed on the first line, without exceeding the character limit. The first word in the line begins in the leftmost position. If there is more than one word in the line, the last word ends in the rightmost position. Extra spaces are inserted into the gaps between the words so that the gaps are as similar as possible. If the gaps cannot be made equal, all of the larger gaps should appear to the left of the smaller ones. Subsequent lines are constructed in the same way.

Your program will read the available width and output the sign on the screen. Use the . character to indicate a space.

#### Constraints

You may assume that .

#### Sample Input 1

15

#### Sample Output 1

WELCOME..TO.CCC
GOOD.LUCK.TODAY

#### Sample Input 2

26

#### Sample Output 2

WELCOME..TO..CCC.GOOD.LUCK
TODAY.....................

## Comments

• commented on April 5, 2021, 9:34 p.m. edit 4

nvm

• commented on April 19, 2021, 11:48 a.m. edit 2

I rather have you ask in Slack, not hard coding the test cases you got wrong.

• commented on Jan. 17, 2021, 8:45 p.m. edited

Note: your output should end with a newline

^At least, if you're using something like System.out.print() (Proof: code WA'd until I added a "System.out.println();" after everything)

• commented on Feb. 5, 2021, 4:14 p.m.

why did he get downvoted xD

I did that and it fixed my code

• commented on Nov. 15, 2020, 1:28 p.m.

How come my code outputs the correct answer in my ide but not on dmoj? I can't seem to figure out what's wrong w my code

• commented on March 17, 2016, 2:25 p.m.

My code works in c++11 but not c++14. Why is that? I am using MS Visual Studio 2015 and my code worked just fin, but when i compiled it using the c++14 one on dmoj, i got this weird glitch (it would print out Y twice for some cases). so much time wasted... ;-;