WC '15 Contest 2 J1 - A New Hope

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
C# 3.0s
Memory limit: 16M
C# 32M

Author:
Problem type
Woburn Challenge 2015-16 Round 2 - Junior Division

"It is a period of civil war. Rebel programs, striking from a hidden computer, have won their first victory against the evil System Tests."

You might be aware that the events of the Star Wars saga took place a long time ago, in a galaxy that was rather far away. But just how far away was it? We can try to describe it by repeating the word far a certain number of times in the following sentence format:

A long time ago in a galaxy far, far away...

In the above example, the word far is repeated twice. However, we'd instead like to repeat it exactly N (1 \le N \le 5) times without changing the rest of the sentence at all. There should be a comma right after each occurrence except for the last one.

Given N, can you produce the correct sentence?

Input Specification

The input consists of a single integer N.

Output Specification

Output on a single line the appropriate sentence with far repeated N times. It must match the correct answer exactly!

Sample Input 1

1

Sample Output 1

A long time ago in a galaxy far away...

Sample Input 2

4

Sample Output 2

A long time ago in a galaxy far, far, far, far away...

Comments


  • 0
    supri03  commented on Dec. 20, 2022, 6:24 a.m.

    Good problem, took me a while to solve this.


  • 0
    Samvsp4k  commented on Nov. 30, 2022, 1:31 a.m.

    I can see that my output is printing out correctly but it keeps saying “Your output is clipped”. Hmm what could I do to fix?


    • 0
      John  commented on Nov. 30, 2022, 2:05 p.m.

      Cause the output's too long. You can't fix it, that's on purpose.


  • -2
    smartraj  commented on Sept. 3, 2022, 11:56 a.m.

    Is the above expecting 3 inputs, sentence, word to be repeated and count ?


    • 0
      panzer_shrek  commented on Sept. 3, 2022, 3:37 p.m.

      The input consists of a single integer N.

      Only one input, number of times you should repeat the word "far".

      The base sentence is "A long time ago in a galaxy [something] away..."


  • 1
    AnirudhBV  commented on Dec. 2, 2021, 7:00 p.m.

    Very nice challenge! I was stuck on it at first but noticed the pattern :) . Very good problem. Thank you SourSpinach.


  • 1
    jasonreeson  commented on Sept. 2, 2021, 9:56 p.m. edited

    Trying to figure out what I'm doing wrong. I'm confident I'm solving the problem efficiently:

    What did I do wrong? Thanks in advance.


    • 6
      Kirito  commented on Sept. 3, 2021, 1:14 a.m. edited
      1. Don't post your code in the comments: anyone who has solved the problem can see your submissions.
      2. Check your output against the samples very carefully. You are missing something...

      • 2
        jasonreeson  commented on Sept. 3, 2021, 9:59 a.m. edited

        Thanks. Missed the '...'!