z-ssp
For given A and B, you have to count how many numbers in the interval [ A, B ] can be represented as a sum of at least 2 squares and at most K squares of prime numbers.
InputStandard input will contain three integers A (1 <= A <= B), B (1 <= B <= 20 000) and K (2 <= K <= 20).
OutputOn the standard ouput you should print how many numbers in the interval [ A, B ] can be represented in the decsribed way.
Input:
Output:
The following numbers can be represented as a sum of at least 2 and at most 4 squares of prime numbers:
8 = 2<sup>2</sup> + 2<sup>2</sup>; 12 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 13 = 2<sup>2</sup> + 3<sup>2</sup>;
16 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 17 = 2<sup>2</sup> + 2<sup>2</sup> + 3<sup>2</sup>; 18 = 3<sup>2</sup> + 3<sup>2</sup>.
1 20 4Output:
6The following numbers can be represented as a sum of at least 2 and at most 4 squares of prime numbers:
8 = 2<sup>2</sup> + 2<sup>2</sup>; 12 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 13 = 2<sup>2</sup> + 3<sup>2</sup>;
16 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 17 = 2<sup>2</sup> + 2<sup>2</sup> + 3<sup>2</sup>; 18 = 3<sup>2</sup> + 3<sup>2</sup>.
Input:
Output:
37 57 3Output:
6Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.