|
|||
Magic FormulaYou are given a quadratic function f(n) = ax2 + bx + c. You are also given a divisor d and a limit L. How many of the function values f(0), f(1), …, f(L) are divisible by d? Input SpecificationThe input consists of a number of test cases. Each test case consists of a single line containing the numbers a, b, c, d, and L (–1000 ≤ a, b, c ≤ 1000, 1 < d < 1 000 000, 0 ≤ L < 1000). The input is terminated by a line containing “0 0 0 0 0”, which should not be processed. Output SpecificationPrint the answer for each test case (the number of function values f(0), f(1), …, f(L) divisible by d) in a separate line. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |