CCC '04 J2 - Terms of Office

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

2004 Canadian Computing Competition, Stage 1

In CS City, a mathematical place to live, the mayor is elected every 4 years, the treasurer is appointed every 2 years, the chief programmer is elected every 3 years and the dog-catcher is replaced every 5 years.

This year, Year X, the newly elected mayor announced the appointment of the new treasurer, a new dog-catcher and congratulated the chief programmer for winning the recent election. That is, all positions were changed over. This is highly unusual. You will quantify how unusual this really is.

Write a program that inputs the year X and the future year Y and lists all years between X and Y inclusive when all positions change.

Sample Input

2004
2100

Sample Output

All positions change in year 2004
All positions change in year 2064

Comments


  • -1
    Mxtute  commented on Dec. 6, 2017, 11:58 a.m. edit 7

    Having  trouble.


    • 0
      Roynaruto  commented on Dec. 6, 2017, 12:27 p.m.

      The mayor every 4, the treasurer every 2, the chief programmer every 3, and the dog-catcher every 5 years. How many years does it take for all of them to change at the same time? Think very carefully.


  • -3
    MateiG  commented on July 4, 2017, 5:23 a.m.

    It says IR, and then WA, but every input that I've tried works. Are you sure that your inputs are correct in terms of what the question specifies?!


    • 4
      Kirito  commented on July 4, 2017, 11:02 a.m.

      Consider that over 400 users have solved the problem. Is it more likely that there is an error in the input, or an error in your program?

      Hint: Python's range(X, Y) generates the range [X, Y) (i.e. includes first number, excludes last number), but the question wants the range [X, Y] (i.e. includes first number and last number).