67 - ZOJ Monthly, June 2008 - 1002
Write a program which reads three positive integers n, p, q. Decide whether or not there exists a sequence of n integers such that the sum of any p consecutive elements is positive and the sum of any q consecutive ones is negative. If the answer is YES, your program has to produce such a sequence.
Each line of the input file will be 3 single positive numbers n, p, q You may assume that 0 < n, p , q < 5000.
The output consists of NO or YES followed by a sequence of n integers written on display.
4 2 3 6 5 3
NO YES -3 5 -3 -3 5 -3
Author: ZHANG, Rui